ProAnswers.org

Write a C program to simulate a digital clock?

#include

#include 

#include 

void main() 

{ 

int h,m,s; 

clrscr(); 

for(h=1;h<=12;h++) 

{ 

clrscr(); 

for(m=1;m<=59;m++) 

{ 

clrscr(); 

for(s=1;s<=59;s++) 

{ 

Gotoxy(8,8); 

printf(“hh mm ss”); 

gotoxy(8,9); 

printf(“%d%d%d”, h,m,s); 

sleep(1); 

} 

} 

} 

getch(); 

} 

Output: 

Hh mm ss 

1 1 1