Posted by hafsa on Tuesday, March 20, 2012 at 4:03am.
You'll need to first determine if the year is a leap year by the rules given above:
int isLeap(int year){
int leap=0;
if(year divisible by 4)leap=1;
if(year divisible by 100)leap=0;
if(year divisible by 400)leap=1;
return leap;
}
Then make an array of cumulative number of days of the previous month, example:
int cndpm(int n){
// n=month, 1=january, ...12 = december
int count[12];
count[0]=0;
count[1]=31;
count[2]=59; // 60 for leap year
...
}
So for March, cndpm(2) will return the total number of days before March 1st.
I'll let you think about the rest, and post if you need further help.
LOL I ARE SO COOL
Related Questions
Logic - Draw a flowchart for a program that reads a date in an 8-digit sequence...
Java/programming - write a program that determines the number of days in a given...
c++ programming - Solve the following problem. Apply all the steps i.e ...
programming - write a program that determines how many names are on the boy'...
computer programming - Write a program that simulates the dial of a phone number...
Programming - Write a pseudocode program that asks the user for an integer ...
Programming - Design a program in pseudocode that calculates the amount of money...
Computer Programming - I must write a program using Java that calculates the ...
programming - I am supposed to modify this program so it begins by asking the ...
programming 2 - Write a program that inputs a word representing a binary number...
For Further Reading