- 2
Write a program-timer, that will take the count of seconds as input and output to the console all the seconds until timer stops?
code I used- function main(){ var seconds=parseInt(readline(),10) var i=0; while(i<=10){ console.log(i) i=seconds-1; } }
3 Antworten
+ 4
function main() {
var seconds = parseInt(readLine(), 10)
while(seconds>=0){
console.log(seconds)
seconds--
}
}
0
//try this
while(seconds>=i){
console.log(seconds)
seconds--
}
0
var i=seconds;
for(;i>=0;i--)
{
console.log(i);
}