running time out. | Sololearn: Learn to code for FREE!

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; }

10/5/2020 10:07:53 AM

kiran Tamang

4 Answers

New Answer

+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.

+2

It is probably because you have many nesteda loops. You can look for a better way to write your code.

+1

Thanks for your advice sir @Martin Taylor