In this post, I am going to write a C program with Nested if statements to find the Leap year.
This example C program is very much useful for school students and for the beginners.
// include the header files #include#include void main() { int x; printf("Enter a year:"); scanf("%d", & x); // nested if statements to check Leap year if (x % 4 == 0) { if (x % 100 == 0) { if (x % 400 == 0) { printf("%d is a leap year", x); exit(0); } else { printf("%d is not a leap year", x); exit(0); } } else { printf("%d is a leap year", x); } } else { printf("%d is not a leap year", x); } }
I believe this post would have helped you to understand how to write a nested If statement in C language and also how to find leap year.
The post Find Leap Year in C language using Nested If statements appeared first on Tutorials Made.