Leap year

Program:

#include<stdio.h>
int main()
{
int y;
printf("Enter year: ");
scanf("%d",&y);
if((y%4==0 && y%100!=0) || (y%400==0))
{
printf("%d is a leap year",y);
}
else
{
printf("%d is not a leap year",y);
}
return 0;

}

Output:




No comments:

Post a Comment

x^y using recursion

Program: #include<stdio.h> int power(int a,int b); int main() { int x,y,ans; printf("Enter x and y:\n "); scanf(...