Thursday, 3 September 2015
LEAST COMMON MULTIPLE CALCULATOR CODE


-----------------------------------------------------------------------------------------------------------------
COPY AND PASTE BELOW CODE IN POST HTML SECTION
------------------------------------------------------------------------------------------------------------------
<!doctype html>
<html>
<head>
<!-- #BeginEditable "doctitle" -->
<title>Least Common Multiple Calculator</title>
<!-- #EndEditable -->
<script type='text/javascript'>
//<![CDATA[
function lcmtoolMain() {
this.version = '007';
w = 500;
h = 260;
var s = '';
s += '<div style="position:relative; width:' + w + 'px; height:' + h + 'px; border-radius: 10px; margin:auto; display:block; background-image: url(https://scontent-lhr3-1.xx.fbcdn.net/hphotos-xtp1/v/t1.0-9/11700798_449077528586911_7615001439496110272_n.png?oh=d70c81dfc00d9f8bf2bb3650fa93c838&oe=562558F5); ">';
s += '<div style="font: bold 16px Arial; color: blue; line-height: 30px;">';
s += '<div style="line-height: 6px;"> </div>';
s += '<div style="line-height: 36px;">';
var opt = '';
for (var i = 0; i < 3; i++) {
if (i == 2) opt = ' (optional)';
s += '<div style="width: 240px; text-align: right; display: inline-block;">';
s += '<span style="font: bold 16px Arial; color: blue;">Number' + opt + ': </span>';
s += '<input type="text" id="text' + i + '" style="color: #0000ff; background-color: #eeffee; text-align:center; font: 20px Arial; width:80px; border-radius: 10px; " value="" onKeyUp="go()" />';
s += '</div>';
s += ' <div id="mults' + i + '" style="position:absolute; margin: 8px 0 0 5px; display: inline-block; font: 14px Arial; color: blue;"></div>';
s += '<br/>';
}
s += '</div>';
s += '<div id="answer" style="width:' + w + '; text-align: center; font: bold 30px Arial; color: darkgreen; line-height: 45px; margin: 10px 0 10px 0;"></div>';
s += ' <div id="example" style="font: 16px Arial; color: black;"></div>';
s += '</div>';
s += '<div id="copyrt" style="font: 7pt arial; font-weight: bold; color: #6600cc; position:absolute; left:5px; bottom:3px;">© 2015 FBGadgets.com v' + this.version + '</div>';
s += '</div>';
document.write(s);
go();
}
function go() {
var vals = [];
for (var i = 0; i < 3; i++) {
var div = document.getElementById('text' + i);
var val = Math.abs(div.value >> 0);
vals.push(val);
if (val == 0) val = '';
div.value = val;
}
var input1 = +vals[0];
var input2 = +vals[1];
var input3 = +vals[2];
if (input3 != "") {
var lcmval = lcm(lcm(input1, input2), input3);
} else {
lcmval = lcm(input1, input2);
}
if (lcmval > 0) {
document.getElementById('answer').innerHTML = 'LCM is ' + lcmval.toString();
} else {
document.getElementById('answer').innerHTML = '';
}
var ex = '';
if (input1 > 0 && input2 > 0 && input3 == 0) {
var opStyle = 'line-height: 40px; vertical-align: top; display: inline-block; text-align: center;';
ex = '<span style="font: 15px Arial;" >Example Fraction Addition:</span><br>';
ex += '<div style=" text-align: center; ">';
ex += getFracHTML(1, input1);
ex += '<div style="width:26px; ' + opStyle + ' "> + </div>';
ex += getFracHTML(1, input2);
ex += '<div style="width:40px; ' + opStyle + ' "> = </div>';
ex += getFracHTML((lcmval / input1), lcmval);
ex += '<div style="width:26px; ' + opStyle + ' "> + </div>';
ex += getFracHTML((lcmval / input2), lcmval);
var numans = (lcmval / input1) + (lcmval / input2);
ex += '<div style="width:40px; ' + opStyle + ' "> = </div>';
ex += getFracHTML(numans, lcmval);
var f = simplify(numans, lcmval);
if (f > 1) {
ex += '<div style="width:40px; ' + opStyle + ' "> = </div>';
if ((lcmval / f) == 1) {
ex += "<span class=\"large\">" + (numans / f) + "</span>";
} else {
ex += getFracHTML((numans / f), (lcmval / f));
}
}
}
ex += '</div>';
var example = document.getElementById("example");
example.innerHTML = ex;
for (i = 0; i < 3; i++) {
div = document.getElementById('mults' + i);
div.innerHTML = getMultiples(vals[i], lcmval);
}
}
function hcf(text1, text2) {
var gcd = 1;
if (text1 > text2) {
text1 = text1 + text2;
text2 = text1 - text2;
text1 = text1 - text2;
}
if ((text2 == (Math.round(text2 / text1)) * text1)) {
gcd = text1
} else {
for (var i = Math.round(text1 / 2); i > 1; i = i - 1) {
if ((text1 == (Math.round(text1 / i)) * i))
if ((text2 == (Math.round(text2 / i)) * i)) {
gcd = i;
i = -1;
}
}
}
return gcd;
}
function lcm(t1, t2) {
var f = hcf(t1, t2);
return t1 * t2 / f;
}
function simplify(n, d) {
var x = 1;
var f = 2;
var e = Math.min(n, d);
while (f <= e) {
while (!((n % f) + (d % f))) {
n = n / f;
d = d / f;
x *= f;
}
if (f == 2) {
f--
}
f += 2;
}
return x;
}
function getFracHTML(a, b) {
var s = '';
s += '<div style="display: inline-block; font: 16px Arial; text-align: center;">';
s += '<div> ';
s += a;
s += ' </div>';
s += '<div style="border-top: 2px solid black;"> ';
s += b;
s += ' </div>';
s += '</div>';
return s;
}
function getMultiples(num, lcm) {
var s = '';
if (num > 0 && lcm > 0) {
var mult = lcm / num;
var len = lcm.toString().length;
var ms = [];
for (var i = 1; i <= mult && len < 35; i++) {
var m = num * i;
ms.push(m);
len += m.toString().length;
len += 2;
}
if (m != lcm) {
ms.push(lcm);
ms[ms.length - 2] = '...';
}
s += ms.join(', ');
}
return s;
}
//]]>
</script>
</head>
<body>
<div class="centerfull">
<div id="content" role="main"> <!-- #BeginEditable "Body" -->
<h1 align="center">Least Common Multiple Calculator</h1>
<br />
</p>
<script type="text/javascript">lcmtoolMain();</script>
</div>
</div>
</body>
</html>
Related movie you might like to see :

ONLINE CSS UNMINIFIER

CSSO (CSS Optimizer)

SCRIPT TUTORIALS CSSO CSS COMPOSER ...

WHITE SPACE REMOVER CODE

White Space Remover

COMMENTS REMOVER CODE

COMMENTS REMOVER

FILE SAVE AS WITH JAVA SCRIPT METHO...

FILE SAVE AS WITH JAVA SCRIPT METH...

HTML CSS JAVA COMPRESSOR CODE

HTML CSS JAVA COMPRESSOR

ONLINE CSS UNMINIFIER CODE
?
+
X
Recommended for you
Loading..
Related Post for LEAST COMMON MULTIPLE CALCULATOR CODE
TRANSLATE IN JAVA SCRIPT -------------------------------------------------------------------------------------------------------------------------- ENGLISH TO HINDI CODE ------------------------------…
DATA URI CODE IMAGE CONVERT INTO JPG IMAGE Best Online Base64 to Image converter .arrow_box { position: relative; background: #ffffff; border: 4px solid #E9E9E9; } .arrow_box:after,.arrow_box:before { top: 100%; lef…
COMPRESS HTML COMPRESS HTML #content{width:500px;margin:0;padding:0;} h1 { width:500px; background: repeating-linear-gradient( 45deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2) 10p…
URDU TYPE WRITER CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
LINEAR EQUATION CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
JavaScript Compressor Packer A JavaScript Compressor h1 { display: block; font-size: 2em; margin-top: 0.67em; margin-bottom: 0.67em; margin-left: 0; margin-right: 0; font-weight: bold;background: …
HOW MANY DIVISORS DOES A NUMBER HAVE? -------------------------------------------------------------------------------------------------------------------------- READ MORE: http://primes.utm.edu/glossary/xpage/tau.…
HOW MANY DIVISORS DOES A NUMBER HAVE? -------------------------------------------------------------------------------------------------------------------------- READ MORE: http://www.javascripter.net/math/calculat…
URDU TYPE WRITER Urdu keyboard Online .bt {cursor:pointer; width:32pt; font-size:20pt; color:#CC0033; font-family:'Times New Roman'; } .bta {cursor:pointer; width:38pt; font-size:20pt; …
HCF AND LCM WITH BRACH METHOD CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
Remove Extra Spaces Remove Extra Spaces html {height:100%;} body {height:100%; margin:0px; padding:0px; font-family:arial; font-size:16px; line-height:1.7; background-color:#DFECFA;} h1 {c…
PRIME FACTORS BRANCH CALCULATOR PRIME FACTORS /* AngularJS v1.2.20 (c) 2010-2014 Google, Inc. http://angularjs.org License: MIT */ (function(S,U,s){'use strict';function v(b){return function(){var …
URL LINK SHORTNER READ MORE FIND THIS WORD (data:image link shortener http://fbgadgets.blogspot.co.uk/2014/12/image-converter-software.htmlIMAGE CONVERTER DATA URI FORMAT http://www.hongkiat…
PRIME FACTORS BRANCH CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
LINEAR EQUATION CALCULATOR #parse_btn { background-color:Blue; color:#FFFFFF; font-size:30px; width:200px; height:50px; } x=3;y=7 Calculate it! Solve Graph Lesson Sh…
GREATEST COMMON FACTOR CALCULATOR CODE -------------------------------------------------------------------------------------------------------------------------- READ MORE: http://maths.wordpandit.com/h-c-f-by-…
HCF AND LCM WITH BRACH METHOD CALCULATOR HIGHEST COMMON FACTOR AND LOWEST COMMON MULTIPLE /* AngularJS v1.2.20 (c) 2010-2014 Google, Inc. http://angularjs.org License: MIT */ (function(S,U,s){'use strict';fu…
Labels:
TEXT TOOLS
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.