Saturday, August 27, 2011

Digital Clock Program in C Language

#include
#include
#include
void main()
{
int h,m,s;
h=0;
m=0;
s=0;
while(1)
{
if(s>59)
{
m=m+1;
s=0;
}
if(m>59)
{
h=h+1;
m=0;
}
if(h>11)
{
h=0;
m=0;
s=0;
}
delay(1000);
s=s+1;
clrscr();
printf("Digital Clock");
printf("HOUR: MINUTE: SECOND\n");
printf("%d: %d: %d",h,m,s);
}
getch();
}

No comments:

Post a Comment