How can I make a timer to count and display number 0? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I make a timer to count and display number 0?

#include <iostream> using namespace std; int main() { int seconds; cin>>seconds; seconds = //your code goes here cout<<seconds; seconds--; return 0; }

24th Oct 2021, 8:59 PM
Earl
Earl - avatar
5 Answers
+ 2
for(int i=seconds; i>=0; i--) cout << i << endl; Keep learning & happy coding :D https://code.sololearn.com/c7CTh5wLAT46
24th Oct 2021, 9:15 PM
SoloProg
SoloProg - avatar
0
Thank you for your help sir. I forgot to mention that I am still in while loop lesson. It says that I should print the output of timer including number 0.
25th Oct 2021, 7:05 AM
Earl
Earl - avatar
0
Q. Create a timer program that will take the number of seconds as input, output the remaining time and countdown to 0. You need to output every number, including 0.
25th Oct 2021, 7:06 AM
Earl
Earl - avatar
0
My output gave an infinite loop of 3.
25th Oct 2021, 7:07 AM
Earl
Earl - avatar
0
We can implement the timer application effectively in javascript than any other programming Since it is scripting development is very easy and comfortable
25th Oct 2021, 10:40 AM
sree harsha
sree harsha - avatar