Count Days In C Program Tamil


#include<stdio.h>
#include<conio.h>
void main()
{
   int mon[12]={31,28,31,30,31,30,31,31,30,31,30,31};
   int fd,fm,fy,sd,sm,sy,i,cd=0;
   clrscr();
   printf("\n                   www.tutorjoes.com\n\n");
   printf("\nEnter First Year & Month & day :\n");
   scanf("%d%d%d",&fy,&fm,&fd);
   printf("\nEnter Second Year & Month & day :\n");
   scanf("%d%d%d",&sy,&sm,&sd);
   i=fm;
   if(fy==sy&&fm==sm)
   {
      cd=sd-fd;
   }
   else
   {
   while(fy!=sy||i!=sm-1)
   {
      if(fy%4==0)
      {
	  mon[1]=29;
      }
      else
      {
	   mon[1]=28;
      }
	cd=cd+mon[i];
      i++;
      if(i==12)
      {
	 i=0;
	 fy++;
      }
   }
   cd=cd+(mon[fm-1]-fd)+sd;
   }
   printf("\nTotal Days : %d",cd);
   getch();
}

Login To Download Source Code

Leave a Comment:

Login To Comment

List Of Programs


Goto Examples

Operators

Looping

Number Conversion

Pattern Design

Arrays

Matrix Examples

Sorting Examples

String Function

Change Case

String In C

Maths Functions

User Defined Functions

Recursive Functions

Pointer

Structure

File Concept

Calender Programming