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 :

HTML CSS JAVA COMPRESSOR CODE

HTML CSS JAVA COMPRESSOR

ONLINE CSS UNMINIFIER CODE

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...
?
+
X
Recommended for you
Loading..
Related Post for LEAST COMMON MULTIPLE CALCULATOR CODE
ADDING SUBTRACTING FRACTION CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
MULTIPLYING FRACTIONS CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, Ar…
PYTHAGOREAN THEOREM CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
ADDING SUBTRACTING FRACTION CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, …
PRIME FACTORING CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, …
PERCENTAGE CHANGE BAR CHART CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
PERCENT CALCULATOR PIE CHART .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
SCIENTIFIC NOTATION CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana,…
PRIME NUMBER CHECKER .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
ADDING SUBTRACTING MIXED NUMBERS CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana…
DIVIDING FRACTIONS CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana,…
PERCENT CALCULATOR PIE CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
PRIME NUMBER GENERATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, …
NON PERFECT SQUARE ROOT CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
PRIME NUMBER GENERATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
LINEAR EQUATION SOLVER CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
TRIANGLE CALCULATOR CODE ---------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION READ MORE: http:…
TRIANGLE CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
PERCENTAGE CHANGE BAR CHART CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
SLOPE CALCULATOR WITH GRAPH CODE ---------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
PRIME NUMBER CHECKER CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
DIVIDING FRACTIONS CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
MATH FRACTION REDUCER CALCULATOR CODE ---------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
COMPARE FRACTIONS CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana,…
COMPARE FRACTIONS CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
ADDING SUBTRACTING 3 FRACTION CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
ADDING SUBTRACTING MIXED NUMBERS CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
SLOPE CALCULATOR WITH GRAPH .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
LINEAR EQUATION SOLVER .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
PYTHAGOREAN THEOREM CALCULATOR CODE ---------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION READ MORE: http:…
MULTIPLYING FRACTIONS CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
MATH FRACTION REDUCER CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
PRIME FACTORING CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
ADDING SUBTRACTING 3 FRACTION CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
SCIENTIFIC NOTATION CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
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.