Vyom World.com Let's Touch the Sky Together!
 Home VyomWorld.com Home Free Magazines! VyomLinks.com Home JobsAssist.com Home Vyom Network Contact Us Jobs & Careers Resume Submitter Placement Papers IT Companies Directory Computer Jobs Interview Questions Online Exams Vyom Career eMag. Fun Screensavers New! Send FREE SMS! SMS Jokes Source Codes Library Source Codes Home ASP Source Codes C Source Codes C++ Source Codes COBOL Source Codes Java Source Codes Pascal Source Codes Submit Source Codes GATE GATE an Overview GATE Preparation Study Materal GRE GRE an Overview GRE Questions GRE Preparation GRE Universities TOEFL Preparation TOEFL Resources GMAT Preparation GMAT Resources MBA Preparation MBA Resources Networking Concepts Networking Concepts Testing Preparation Testing Resources Webmasters Free Traffic Builder Webmaster Articles Web Hosting Tutorials Hardware Tutorial 1500 Free eBooks New! FREE Publications
Vyom Career eMag.
 Get 9,000+ Interview Questions & Answers in an eBook. 9,000+ Interview Questions All Questions Answered 5 FREE Bonuses Free Upgrades Get it now!
Get 9,000+ Interview Questions with Answers in an eBook

C Source Codes List | Source Code Home
Program : Program to find difference between two dates.
#include<stdio.h> #include<math.h> void main() { int day1,mon1,year1,day2,mon2,year2; int ref,dd1,dd2,i; clrscr(); printf("Enter first day, month, year"); scanf("%d%d%d",&day1,&mon1,&year1); scanf("%d%d%d",&day2,&mon2,&year2); ref = year1; if(year2<year1) ref = year2; dd1=0; dd1=func1(mon1); for(i=ref;i<year1;i++) { if(i%4==0) dd1+=1; } dd1=dd1+day1+(year1-ref)*365; printf("No. of days of first date fronm the Jan 1 %d= %d",year1,dd1); /* Count for additional days due to leap years*/ dd2=0; for(i=ref;i<year2;i++) { if(i%4==0) dd2+=1; } dd2=func1(mon2)+dd2+day2+((year2-ref)*365); printf("No. of days from the reference year's first Jan = %d",dd2); printf("Therefore, diff between the two dates is %d",abs(dd2-dd1)); getch(); } int func1(x) //x for month y for dd { int y=0; switch(x) { case 1: y=0; break; case 2: y=31; break; case 3: y=59; break; case 4: y=90; break; case 5: y=120;break; case 6: y=151; break; case 7: y=181; break; case 8: y=212; break; case 9: y=243; break; case 10:y=273; break; case 11:y=304; break; case 12:y=334; break; default: printf("Error encountered"); exit(1); } return(y); }

C Source Codes List | Source Code Home

Recently Updated: New Placement Papers added.
Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Programming & Source Codes | GRE Preparation | Jobs, Discussions | Software Listing | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | International Business Information | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | FAQs | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Excellent Mobiles | Software Testing | Interview Questions | Freshers Jobs | Server Insiders | File Extension Directory