I wrote a code for timer but I am getting output as" no output". | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I wrote a code for timer but I am getting output as" no output".

#include <iostream> using namespace std; int main() { int secondspassed=0; int minspassed=0; int hourspassed=0; while(hourspassed<=24) secondspassed++; cout<<"Hrs=0, Mins = 0"<<"Secs"<<secondspassed<<endl; if(secondspassed==60 ) { minspassed ++; secondspassed=0; secondspassed ++; cout<<"Hrs = 0, "<<"Mins= "<<minspassed<<", Secs = "<<secondspassed<<endl; } if(minspassed==60 ) { hourspassed++; minspassed=0; secondspassed=0; secondspassed ++; cout<<"Hrs = "<<hourspassed<<",Mins= "<<minspassed<<", Secs = "<<secondspassed<<endl; } return 0; }

26th Sep 2020, 12:49 PM
Aquib
Aquib - avatar
4 Answers
+ 1
Your forget open and close the while loop. Line 10: Put { Line 31: Put }
26th Sep 2020, 1:10 PM
Vadivelan
0
Vadivelan thanks for the answer ,but one more thing is that I get at the end execution time out
26th Sep 2020, 2:09 PM
Aquib
Aquib - avatar
0
Thanks Vadivelan
26th Sep 2020, 2:29 PM
Aquib
Aquib - avatar