rangeFinder

 avatar
unknown
javascript
a year ago
816 B
16
Indexable
// Install Prompt-Sync Module Before Running The Program
//Type the following in IDE console-

/* npm install prompt-sync */

while (true) {
    const prompt = require('prompt-sync')();

    const startValue = Number(prompt('Enter Starting Value'));
    const endValue = Number(prompt('Enter Ending Value'));

    if (endValue < startValue) {
        console.log('Invalid Starting And Ending Values! Try Again!')
        continue;

    }
    for (let i = startValue; i <=endValue; i++){
        process.stdout.write(i + " ");
    }

    console.log();

   
    console.log("Do You Want To Perform Another Operation?")
    const isComplete = prompt('Enter Y/N');

    if (isComplete === 'N' || isComplete === 'n') {
        console.log("Thank You! Visit Again!")
        break;
    }
}
Editor is loading...
Leave a Comment