Print Day Using C Program Tamil Part 2


#include<stdio.h>
#include<conio.h>
void main()
{
   int mon[12]={31,28,31,30,31,30,31,31,30,31,30,31};
   int d,m,y,ny,nhy,noy,tonhy,nl,no,tonlno,fiod,tmd=0,seod,i,odd;
   clrscr();
   printf("\nEnter the Year :");
   scanf("%d",&y);
   printf("\nEnter the Month :");
   scanf("%d",&m);
   printf("\nEnter the Day :");
   scanf("%d",&d);
   y=y-1;
   ny=y-1600;
   nhy=ny/100;
   noy=ny%100;
   if(nhy==4||nhy==8||nhy==12||nhy==16)
   {
      tonhy=(nhy*5)+1;
   }
   else
   {
     tonhy=nhy*5;
   }
   nl=noy/4;
   no=noy-nl;
   tonlno=(nl*2)+(no);    //www.tutorjoes.com
   fiod=tonhy+tonlno;
   if((y+1)%4==0)
   {
      mon[1]=29;
   }
   for(i=0;i<=m-2;i++)
   {
	tmd=tmd+mon[i];
   }
   tmd=tmd+d;
   fiod=fiod%7;
   seod=tmd%7;
   odd=fiod+seod;
   if(odd>7)
   {
       odd=odd%7;
   }
   switch(odd)
   {
     case 0:
	     printf("\n Sunday ");
     break;
     case 1:
	     printf("\n  monday");  //www.tutorjoes.com
     break;
     case 2:
	     printf("\n  Tuesday");
     break;
     case 3:
	     printf("\n  wednesday");
     break;
     case 4:
	     printf("\n  Thursday");
     break;
     case 5:
	     printf("\n  Friday");
     break;
     case 6:
	     printf("\n  saturday");
     break;
   }
   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