running time out. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

running time out.

#include<stdio.h> # include<conio.h> int main() { int h,m,s; double i; printf("Provide time in hh:mm:ss: format"); scanf("%d,%d,%d",&h,&m,&s); start: { for(h=1;h<25;h++) { for(m=1;m<61;m++) { for(s=1;s<61;s++) { clrscr(); printf("\n\n\t%d:%d:%d",h,m,s); } if (h<=12) { printf("AM\n"); } else { printf("PM\n"); } { for(i=0;i<369999;i++) i++; i--; } s=0; } m=0; } h=0; goto start; return 0; }

5th Oct 2020, 10:07 AM
kiran Tamang
kiran Tamang - avatar
3 Answers
+ 3
Sololearns compiler stops at a certain period of output. It is because you have a lot of loops. Sololearn stops it so that the device of the person who is running this will not get jammed.
5th Oct 2020, 10:30 AM
Steve Sajeev
Steve Sajeev - avatar
+ 2
It is probably because you have many nesteda loops. You can look for a better way to write your code.
5th Oct 2020, 10:20 AM
C K
C K - avatar
+ 1
Thanks for your advice sir @Martin Taylor
5th Oct 2020, 11:30 AM
kiran Tamang
kiran Tamang - avatar