mirror of
https://github.com/hexahigh/games.git
synced 2025-12-11 20:15:38 +01:00
update
This commit is contained in:
parent
936c3ccb01
commit
ad81658e58
@ -6,8 +6,10 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
</head>
|
||||
<body>
|
||||
<button onclick="generatePrime()">Start</button>
|
||||
<button onclick="preGenerate()">Start</button>
|
||||
<div>
|
||||
<p id="status">Idle</p>
|
||||
<br>
|
||||
<p id="Text"></p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@ -1,3 +1,15 @@
|
||||
function preGenerate() {
|
||||
let statusText = document.getElementById("status")
|
||||
statusText.innerText = "Generating, please wait!"
|
||||
generatePrime()
|
||||
};
|
||||
|
||||
function afterGenerate() {
|
||||
let statusText = document.getElementById("status")
|
||||
statusText.innerText = "Generated!"
|
||||
};
|
||||
|
||||
|
||||
// program to print prime numbers between the two numbers
|
||||
async function generatePrime() {
|
||||
// take input from the user
|
||||
@ -21,10 +33,10 @@ async function generatePrime() {
|
||||
|
||||
// if number greater than 1 and not divisible by other numbers
|
||||
if (i > 1 && flag == 0) {
|
||||
console.log(i);
|
||||
OutText = document.getElementById("Text").innerText;
|
||||
OutText2 = OutText + " " + i;
|
||||
document.getElementById("Text").innerText = OutText2
|
||||
}
|
||||
}
|
||||
afterGenerate()
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user