Program: 81
Any year is entered through the keyboard, write a c program to determine whether the year is leap or not. Use the logical operators && and ||
#include<stdio.h> #include<conio.h> int main() { int year; printf("Enter the year: "); scanf("%d", &year); if((year%4==0 || year%400==0) && (year%100!=0)) { printf("%d is leap year", year); } else printf("%d is not a leap year", year); }
Output:
Enter the year: 2014
2014 is not a leap year
Leave a Comment