Stopwatch sample c -easy logic !(beginner version )

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

int main(void)
{

    int static a = 0hour = 0min = 0sec = 0;
    printf("Press S to start");
    char ch = getch();
    if (ch == 's' || ch == 'S')
    {
        for (int i = 1;; i++)
        {
            system("cls");
            printf("%d: %d :%d "hourminsec);
            a++;
            if (a == 40)
            {
                milisec = 0;
                sec++;
                if (sec == 60)
                {
                    sec = 0;
                    min++;
                    if (min == 60)
                    {

                        hour++;
                        if (hour == 24)
                        {
                            hour = 0;
                            sec = 0;
                            min = 0;
                        }
                    }
                }
            }
        }
    }

} 

SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

1 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete