/*Leap year function*/
#include<stdio.h> //header files
void main()
{
int Year,Var ; //initialize variable
printf("enter the year");
scanf("%d",&Year);
Var =Year%4 || Year %100 || Year%400; //logic for leap year
//condition is true then enter otherwise goes into else part
if(Var!=0)
{
printf("its a leap year");
}
else
{
printf("its not a leap year");
}
} //End of main
No comments:
Post a Comment