Digital watch project in c
by ujjal roy
#include<stdio.h>
#include<Windows.h>
#ifdef _WIN32
#define sleep(x) Sleep(x*1000);
#endif // _WIN32
main()
{
int h,m,s;
printf("set your time hour : minute : second : \n");
scanf("%d%d%d",&h,&m,&s);
while(1)
{ system("cls");
printf("\t\t****************DIGITAL WATCH*************\n\n");
printf("\t\t\t\t%.2d : %.2d : %.2d\n",h,m,s);
printf("\n\t\t*****************************************\n\n");
sleep(1);
s++;
if(s>=60)
{
m++;
s=0;
}
if(m>=60)
{
h++;
m=0;
}
if(h>=12)
{
h=0;
}
}
getch();
}
0 Comments