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 314445d commit 1c244a7
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
if (cloud_calculations == undefined) {
cloud_calculations = 0;
}
cloud_calculations++;
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();
Expand All @@ -21,7 +22,25 @@
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);
}
</script>

Expand Down

0 comments on commit 1c244a7

Please sign in to comment.