In the previous blog we saw how to find the reverse of number. Now, we will see how to find if the given year is leap year or not .

Conditional Statements:-

If condition:-

The if statement is used to examine a given condition and perform actions based on whether or not that condition is true. It's most commonly utilized in scenarios where we need to perform many operations for various situations. The if statement's syntax is seen below.

if(expression)

{

}

If-Else Condition:-

For a single condition, the if-else statement is used to conduct two operations. It's an enhancement to the if statement that allows us to conduct two different operations, one for the condition's correctness and the other for the condition's incorrectness. It is important to note that the if and else blocks cannot be run at the same time. The syntax is seen below.

if(expression)

{

}

else

{

}

To check if the given year is leap or not .

Example:-

The leap year must be divisible by 400 or it can be divisible by 4 but should not be divisible by 100 .Then we can confirm that its a leap year 

Consider,

1900 Its not a leap year because its not divisible by 400 or its not divisible by 4 but its divisible by 100 .

2000 It a leap year because its divisible  by 400 

Code:-

#include <stdio.h>

int main()

{

  int year;

  printf("Enter the year");

  scanf("%d",&year);

  if(year%4==0 && year%100 !=0||year%400==0)

  {

      printf("IT'S LeapYear");

  }

  else

  {

      printf("IT'S Not LeapYear");

  }

}

Algorithm:-
1.Start 
2.Input a variable called year by using scanf and use format specifier "%d".
3.Use the if else block to check if its leap or not .
4.If the leap year is divisible by 400 or its divisible by 4 but should not be divisible by 100 .Then we can confirm that its a leap year and print that statement .
5.Else its not a leap year and print that statement 
6.Stop 
Screenshot:-
1.Code Screenshot:-


2.Output Screenshot:-



In the next blog we will see how to check if the given mark is pass or fail for a student.