I'm new to C programming. I could not understand how to write the following programs.

1. Any year is input through keyboard. Write aprogram to determine whether it is a leap year or not.

That's simple,lol

Just divide the year by 4 using modulus (%).

if(year % 4 == 0) cout<< "Yahoo a leap year";

A complete leap year calculation is something along these lines....

A year is a leap year if it can be divided by 4 with no remainder....
EXCEPT if it is divisible by 100 with no remainder....
EXCEPT if it is divisible by 400 with no remainder.

So 2004 is a leap year (divisble by 4)
1900 was NOT (divisible by 100)
2000 WAS (though it was divisible by 100, it was also divisible by 400)

I'm new to C programming. I could not understand how to write the following programs.

1. Any year is input through keyboard. Write aprogram to determine whether it is a leap year or not.

its a very basic prog.

take a user i/p. then chk if it is divisible by 100(eg.1900,1800,2000)
if yes divide the number by 400(use mod fn). if it is giving no rem,then it is a leap yr.

if no. is not a multiple of 100, divide by 4 and get ur ans.

all the best

the condition must be:
if((y%4==0&&y%100!=0)!!(y%400=-0)) pf("leap year") ......it goes like this