write a c-program to display the time using FOR loop

Answers were Sorted based on User's Feedback



write a c-program to display the time using FOR loop..

Answer / chaitanya

main()
{
for(;1;)
{
int hr,mt,sec;
for(hr=0;hr<24;hr++)
{
for(mt=0;mt<60;mt++)
{
for(sec=0;sec<60;sec++)
{
sleep(1000);
printf("%d:%d:%d",hr,mt,sec);
}
}
}
}
}

Is This Answer Correct ?    8 Yes 8 No

write a c-program to display the time using FOR loop..

Answer / guru

sir, actually i want same program but not using for loop,
using goto statement

Is This Answer Correct ?    1 Yes 2 No

write a c-program to display the time using FOR loop..

Answer / venugopal

main()
{
int hr,mt,sec;
for(hr=0;hr<12;hr++)
{
for(mt=0;mt<60;mt++)
{
for(sec=0;sec<60;sec++)
{
sleep(1000);
printf("%d:%d:%d",hr,mt,sec);
}
}
}/* here sleep(1000) maintain intervel of one sec b/w two
print statements*/ if u have any doubts contact my mail-id
is: venugopal.palavalasa@gmail.com

Is This Answer Correct ?    7 Yes 13 No

Post New Answer

More C Code Interview Questions

prog. to produce 1 2 3 4 5 6 7 8 9 10

4 Answers   TCS,


write the function. if all the character in string B appear in string A, return true, otherwise return false.

11 Answers   Google,


main() { struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

1 Answers  


Link list in reverse order.

8 Answers   NetApp,


int i=10; main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); }

1 Answers  






main() { int i; clrscr(); for(i=0;i<5;i++) { printf("%d\n", 1L << i); } } a. 5, 4, 3, 2, 1 b. 0, 1, 2, 3, 4 c. 0, 1, 2, 4, 8 d. 1, 2, 4, 8, 16

4 Answers   HCL,


write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30

0 Answers  


3) Int Matrix of certain size was given, We had few valu= es in it like this. =97=97=97=97=97=97=97=97=97=97=97 1 = | 4 | | 5 | &= nbsp; | 45 =97=97=97=97=97=97=97=97=97=97=97 &n= bsp; | 3 | 3 | 5 | = | 4 =97=97=97=97=97=97=97=97=97=97=97 34 |&nbs= p; 3 | 3 | | 12 | &= nbsp; =97=97=97=97=97=97=97=97=97=97=97 3 | &nbs= p; | 3 | 4 | = | 3 =97=97=97=97=97=97=97=97=97=97=97 3 | = ; | | | = ; 3 | =97=97=97=97=97=97=97=97=97=97=97 &= nbsp; | | 4 | = ; | 4 | 3 We w= ere supposed to move back all the spaces in it at the end. Note: = If implemented this prog using recursion, would get higher preference.

0 Answers   RoboSoft,


void main() { int k=ret(sizeof(float)); printf("\n here value is %d",++k); } int ret(int ret) { ret += 2.5; return(ret); }

1 Answers  


program to find the roots of a quadratic equation

14 Answers   College School Exams Tests, Engineering, HP, IIIT, Infosys, Rajiv Gandhi University of Knowledge Technologies RGUKT, SSC,


How do you create a really large matrix (i.e. 3500x3500) in C without having the program crash? I can only reach up to 2500. It must have something to do with lack of memory. Please help!

1 Answers  


int a=1; printf("%d %d %d",a++,a++,a); need o/p in 'c' and what explanation too

1 Answers  


Categories