This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<h3>Click the button to execute Seive of Eratosthenes</h3> | |
<div id="buttondiv"> | |
<button id="Button" onclick="FindPrime()">Give a number</button> | |
</div> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let Boolarray = []; | |
let n = 100; | |
for (var i = 0; i < n; i++) { | |
Boolarray.push(true); | |
} | |
for (let j = 2; j * j <= n; j++) { | |
if (Boolarray[j] == true) { | |
for (let k = 2 * j; k <= n; k += j) { | |
Boolarray[k] = false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sample string in JS | |
let sample_string = "Hello readers"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sample string | |
let sample_string = "wsad"; | |
// substrings of the above string | |
w | |
ws | |
wsa | |
wsad | |
s | |
sa | |
sad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialising input string | |
let inpstring = "Hello"; | |
// length of the input string | |
let n = inpstring.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let inpstring = "abc"; | |
let n = inpstring.length; | |
function FindSubstring(Str, n){ | |
for(let i=0; i<n ;i++){ | |
// We are going to have two more loops here | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let inpstring = "abc"; | |
let n = inpstring.length; | |
function FindSubstring(Str, n){ | |
for(let i=0; i<n ;i++){ | |
for(let j=i;j<n;j++){ | |
// another for loop comes here | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let inpstring = "abc"; | |
let n = inpstring.length; | |
function FindSubstring(Str, n){ | |
for(let i=0; i<n ;i++){ | |
for(let j=i;j<n;j++){ | |
for(let k=i;k<j+1;k++){ | |
console.log(Str.charAt(k)) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let inpstring = "abc"; | |
let n = inpstring.length; | |
function FindSubstring(Str, n){ | |
for(let i=0; i<n ;i++){ | |
/* console.log(i) */ | |
for(let j=i;j<n;j++){ | |
for(let k=i;k<j+1;k++){ | |
console.log(Str.charAt(k)) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let inpstring = "abc"; | |
let n = inpstring.length; | |
function FindSubstring(Str, n){ | |
for(let i=0; i<n ;i++){ | |
/* console.log(i) */ | |
for(let j=i;j<n;j++){ | |
for(let k=i;k<j+1;k++){ | |
console.log(Str.charAt(k)) | |
} | |
} |
OlderNewer