Sie sind auf Seite 1von 10

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

Jnana Sangama, Belagavi-590018, Karnataka

C PROGRAMMING FOR PROBLEM SOLVING


Technical seminar report on

“DIGITAL CLOCK”

Submitted by

Group number: 1

For the academic year 2018-19

BANGALORE INSTITUTE OF TECHNOLOGY


K.R. Road, V.V.Pura, Bengaluru-560 004
BANGALORE INSTITUTE OF TECHNOLOGY
K.R. Road, V.V.Puram, Bengalure-560 004

Certificate

This is to certify that the implementation of CPS MINI PROJECT


entitled “Digital Clock” has been successfully completed by 1(Group
number) of Il semester B.E for the fulfillment of practical exposure during
the academic year 2018-2019.

Staff In-charge:

Kavitha
Asst. Professor
Dept. of CS&E
Bangalore Institute of Technology
Bangalore
Group Members

USN Name

1BI18CS008 ABHISHEK RAJU V


1BI18CS007 ABHISHEK M

CONTENTS

Introduction (Page No)

1.1 Introduction 1
1.
1.2 Problem Statement 2

Project Source Code

Initialization of year, month, day,


2.1 3
date, etc.
For loop for systematic working of
2.2 4
2. the clock

2.3 Terminating Statements 5

3. Output Screenshot 6
4. Conclusion 7

INTRODUCTION

Clock is one of the most important component of our day to day life. It
can be used for various purpose like:-
1)This program can be used to take the count of the time.
2)This program can also be used as timers essential in online exams,etc.
3)This program can also be used in places where the count of second
matters, like in races.
4)This program can also be used in the day-to-day life.

Without clock the daily work is not possible while no one will be able to
take the count of time.
With the help of digital clock one can also access to the day and date in
addition with the time. This additional feature is very important as it
saves one from checking calendars on a regular note.

___________
Problem Statement

The introduction of concept of digital clock is a revolution in modern


era.It enables us to many additional features other than a simple a
clock.We can access days and date through a digital clock.It can be used
as a timer or even as an alarm clock.Timers are necessary during online
exams which has now become a new trend across globe.It is also useful
during races and other kind of sports.

It also takes the count of leap year and we can even access to the past
year for any kind of information.This application is important in many
fields like investigation and fields where we need to enter date of birth.

________________

Source Code
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#define True 1
#define False 0
void main()
{
int days_in_month[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int h=0,m=0,s=0,day=0,date,month,year;
printf("Enter a year");
scanf("%d",&year);
if(year%4==False&&year%100!=False||year%400==False)
{
days_in_month[2]=29;
}
else
{
days_in_month[2]=28;
}
printf("Enter the date and month");
scanf("%d%d",&date,&month);
printf("Enter the time in hh:mm:ss");
scanf("%d%d%d",&h,&m,&s);
start:;
for(year;year<2050;year++)
{
for(month=1;month<12;month++)
{
for(day=0,date;day<7,date<days_in_month[1];day++,date++)
{
for(h;h<24;h++)
{
for(m;m<60;m++)
{
for(s;s<60;s++)
{
printf("%d:%d:%d\n",h,m,s);

delay(1000);
clrscr();.
printf("\n");
if(day==0)
printf("Sunday");
else if(day==1)
printf("Monday");
else if(day==2)
printf("Tuesday");
else if(day==3)
printf("Wednesday");
else if(day==4)
printf("Thrusday");
else if(day==5)
printf("Friday");
else if(day==6)
printf("Saturday");
else
printf("wrong choice");
printf("\n");
day=0;
if(month==1)
printf("%d/Jan/%d\n",date,year);
else if(month==2)
printf("%d/Feb/%d\n",date,year);
else if(month==3)
printf("%d/Mar/%d\n",date,year);
else if(month==4)
printf("%d/Apr/%d\n",date,year);
else if(month==5)
printf("%d/May/%d\n",date,year);
else if(month==6)
printf("%d/June/%d\n",date,year);
else if(month==7)
printf("%d/July/%d\n",date,year);
else if(month==8)
printf("%d/Aug/%d\n",date,year);
else if(month==9)
printf("%d/Sept/%d\n",date,year);
else if(month==10)
printf("%d/Oct/%d\n",date,year);
else if(month==11)
printf("%d/Nov/%d\n",date,year);
else if(month==12)
printf("%d/Dec/%d\n",date,year);
else
printf("wrong choice");

} s=0;
}m=0;.
}h=0;
}day=0;date=1;
}month=1;
}
goto start;
getch();

}
________________________

Output Screenshots
________________

Conclusion

The clock will run for indefinite time with ‘second’ changing after
each second and ‘minute’ will change once the second count reaches
60.After that the ‘hour’ will change after the minute count reaches
60 similarly days and date will also change after 24 hours.
By using the features in the code we can use it as a timer and also
other places where we need to look into past years.

___________________

Das könnte Ihnen auch gefallen