Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
WesleyMcGinn authored Oct 9, 2021
1 parent c37835d commit f68c48f
Showing 1 changed file with 48 additions and 43 deletions.
91 changes: 48 additions & 43 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,51 +1,56 @@
<script src="https://kihtrak.com/cloud_variable/cloudify.min.js"></script>

<script>
var cloud_calculations;
if (cloud_calculations == undefined) {
cloud_calculations = 0;
}
var addTo;
var multiplyTo;
var try1;
var try2;
var final1;
var final2;
var tries;
function activateFactoringCalculator() {
cloud_calculations++;
addTo = prompt("The two numbers add to:", "b value");
multiplyTo = prompt("The two numbers multiply to:", "c value");
console.clear();
console.log("Factoring Calculator is starting calculations....");
if (addTo == 0 && multiplyTo == 0) {
try1 = 0;
try2 = 0;
} else {
try1 = -1000;
try2 = -1000;
tries = 0;
do {
tries++;
try1++;
try2 = -1000;
while (try2 <= 1000) {
try2++;
if (try1+try2 == addTo && try1*try2 == multiplyTo) {
final1 = try1;
final2 = try2;
console.log("Got solution:")
console.log(final1);
console.log(final2);
try2 = 1001;
}
}
} while (tries <= 2000);
}
alert("The two numbers are " + str(final1) + " and " + str(final2) + ".");
var cloud_calculations;
if (cloud_calculations == undefined) {
cloud_calculations = 0;
}
var addTo;
var multiplyTo;
var try1;
var try2;
var final1;
var final2;
var tries;
function activateFactoringCalculator() {
cloud_calculations++;
addTo = prompt("The two numbers add to:", "b value");
multiplyTo = prompt("The two numbers multiply to:", "c value");
console.clear();
console.log("Factoring Calculator is starting calculations....");
if (addTo == 0 && multiplyTo == 0) {
try1 = 0;
try2 = 0;
} else {
try1 = -1000;
try2 = -1000;
tries = 0;
do {
tries++;
try1++;
try2 = -1000;
do {
try2++;
if (try1 + try2 == addTo && try1 * try2 == multiplyTo) {
final1 = try1;
final2 = try2;
console.log("Got solution:");
console.log(final1);
console.log(final2);
alert("The two numbers are " + final1 + " and " + final2 + ".");
try2 = 5000;
tries = 5000;
}
} while (try2 <= 1000);
} while (tries <= 2000);
}
}
</script>

<form>
<input type="button" value="CALCULATE!" onClick="activateFactoringCalculator();" alt="Click this button to enter input and calculate." />
<input
type="button"
value="CALCULATE!"
onClick="activateFactoringCalculator();"
/>
</form>

0 comments on commit f68c48f

Please sign in to comment.