Saturday, November 27, 2010

Digital Clock in C Prgramming

Hello this is program for how to generate a digital clock in c programming.

Program Code


//simulate a digital clock
#include "stdio.h"
#include "conio.h"
#include "dos.h"
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("\n DIGITAL CLOCK");
printf("\n HOUR:MINUTE:SECOND");
printf("\n%d:%d:%d",h,m,s);
}

}

Output


6 comments:

ARINDAM SAHA said...

thats nice

Anonymous said...

wow nice

Unknown said...

how to get out of that output

Unknown said...
This comment has been removed by the author.
Unknown said...
This comment has been removed by the author.
Unknown said...

this program is wrong pls check output

Post a Comment

Dont SPAM