Pages

E-mail us at prgms4starters@gmail.com for any queries or to share your programs. Please mention the program definition in the subject line.

In case you need help in finishing a program, do mention "incomplete pgm" in the subject line. Our team of experts will do their best to help you.

Click the link to follow this page for updates and reminders: FOLLOW THIS SITE

You can also visit our Facebook page by clicking HERE

**don't forget to participate in the polls at the bottom of the page

Tuesday, November 9, 2010

C program to find Julian Date (day of the year)

This program does not check for validity of date ie. user has to enter a vaild date in the form dd mm yy
eg.31 12 04 ->julian date: 366 since its a leap year

#include<stdio.h>
void main()
{
int dd,mm,yy,julian;
clrscr();
printf("\nenter a valid date (dd mm yy)");
scanf("%d%d%d",&dd,&mm,&yy);
julian=dd;
mm=mm-1;
switch(mm)
{
case 11 : julian=julian+30;
case 10 : julian=julian+31;
case 9 : julian=julian+30;
case 8 : julian=julian+31;
case 7 : julian=julian+31;
case 6: julian=julian+30;
case 5: julian=julian+31;
case 4 : julian=julian+30;
case 3 : julian=julian+31;
case 2 : if(yy%4==0)julian=julian+29;
             else julian=julian+28;
case 1 : julian=julian+31;
}
printf("\nJulian date is %d",julian);
getch();
}

2 comments:

Anonymous said...

this doesn't compile for me

Anonymous said...

Can u please provide a program for finding julian days of given years?

Post a Comment

We have noticed that 20% of our visitors are still using internet explorer. For a better and faster surfing experience we recommend that you switch to either Google Chrome or Mozilla Firefox. We cannot provide you the downloads but here are the links to sites where you can download them from

Google Chrome - click here to go to site

Mozilla Firefox - click here to go to site

Where are you from

Do you think this site was helpful

Should we put up more C or C++ programs