HOW TO MAKE A STOP WATCH USING C PROGRAMMING.
stop watch:
Youtube Chanel link: Click Here
SOFTWARE NEEDED: turbo c++/turbo c
HOW TO DOWNLOAD TURBO C++?
1. To Download Turbo C++ Click on the link given below:
2. Click on
DOWNLOAD TURBO C++.
3.
4. After
downloading the zip file extract the zip file and double click on the extracted
file folder.
5. Click on
license agreement and then click on next.
6. Keep on clicking next.
7. After that click on install.
8. Then Click on finish.
Now you are
done with the installation.
Source code:
#include<stdio.h>
#include<conio.h>
void main()
{
int h=0,m=0,s=0;
clrscr();
printf("Please enter a time format in HH:MM:SS");
scanf("%d%d%d",&h,&m,&s);
start:
for(h;h<24;h++)
{
for(m;m<60;m++)
{
for(s;s<60;s++)
{
clrscr();
printf("\n\n\t\t\t%d:%d:%d",h,m,s);
for(double i=0;i<3619999;i++)
i++;
i--;
}
s=0;
}
m=0;
}
h=0;
goto start;
getch();
}
Output
Explanation
of code:
This program
will generate a digital stopwatch using
c program.
The logic
behind the implementation of this program is given below.
· At first initialize hour, minute,
seconds with 0.
· Take three for loop for a second,
minutes and hours to be increased.
· Increase second and check when it is
equal to 60 then increase minute and reset seconds to 0.
· Also for minute increase it and check
when it is equal to 60 then increase hour and reset minute to 0.
· Increase hour and check if it is
equal to 24 then as before reset hour to 0.








Good👍👍
ReplyDeleteGood
ReplyDeleteAwesome 👍
ReplyDeleteInformative
ReplyDeleteWow!👌
ReplyDeleteGood Logic
ReplyDelete