Develop a C program to check whether a given year is LEAP YEAR or NOT using Nested if statement
Code
#include <stdio.h>int main(){int year;printf("Enter a year: ");scanf("%d",&year);if(year%4 == 0){if( year%100 == 0){if ( year%400 == 0)printf("%d is a leap year.\n", year);elseprintf("%d is not the leap year.\n", year);}elseprintf("%d is a leap year.\n", year );}elseprintf("%d is not the leap year.\n", year);return 0;}
Output
0 Comments
Post a Comment