This commit is contained in:
Boof 2023-04-27 10:20:23 +02:00 committed by GitHub
parent 936c3ccb01
commit ad81658e58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -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>

View File

@ -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()
}