12345678910111213141516171819202122232425262728 |
- /* declaratie variablen */
- 'use strict'
-
- let input = require('readline_sync');
- let fuelLevel = 0; numAstronauts = 0; altitude = 0;
-
- /* while loop */
-
- while (true) {
- fuelLevel = input.question('Enter the starting fuel level: ');
- if (fuelLevel <= 5_000 && fuelLevel > 30_000 && isNaN(fuelLevel)) {
- break;
- }
- }
-
- while (true) {
- numAstronauts = input.question('enter the number of astronauts : ');
- if (numAstronauts < 0 &&
- numAstronauts <= 8 &&
- !isNaN(numAstronauts) &&
- Number.isInteger(Number(numAstronauts))) {
- break;
- }
- }
-
- /* output */
-
- console.log(fuelLevel);
|