C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




day check


Posted Date: 03 Jun 2008    Resource Type: Code Snippets    Category: C# Syntax
Author: subramanyamMember Level: Silver    
Rating: Points: 2



main()
{
int pd,pm,py,ed,em,ey,count=0,i,year,month,day,total,remain;
clrscr();
printf("enter present date in the formate dd/mm/yyyy\n");
scanf("%d/%d/%d",&pd,&pm,&py);
printf("enter previous date in the formate dd/mm/yyyy\n");
scanf("%d/%d/%d",ed,em,ey);
for(i=ey;i<=py;i++)
{
if(i%4==0||i%400==0&&i%100!=0)
count++;
}
year=py-ey-1;
month=monthdays(pm-1)+(365-monthdays(em+1));
day=pd+days(em)-ed;
total=year+month+day;
total=total+count;
remain=total%7;
printf("remain days is : %d",remain);
getch();
}
monthdays(int n)
{
int i,sum=0;
for(i=1;i<=n;i++)
{
switch(i)
{
case 1:sum+=31; break;
case 2:sum+=28;break;
case 3:sum+=31;break;
case 4:sum+=30;break;
case 5:sum+=31;break;
case 6:sum+=30;break;
case 7:sum+=31;break;
case 8:sum+=31;break;
case 9:sum+=30;break;
case 10:sum+=31;break;
case 11:sum+=30;break;
case 12:sum+=31;break;
}
}
return sum;
}
days(int month)
{
switch(month)
{
case 1:return 31;
case 2:return 28;
case 3:return 31;
case 4:return 30;
case 5:return 31;
case 6:return 30;
case 7:return 31;
case 8:return 31;
case 9:return 30;
case 10:return 31;
case 11:return 30;
case 12:return 31;
}
}




Responses

Author: Sharath Kumar G R    04 Jun 2008Member Level: Silver   Points : 0
good C program


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: days between two dates in C#.NET
Previous Resource: XML Serialization and DeSerialization C#
Return to Discussion Resource Index
Post New Resource
Category: C# Syntax


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use