Friday, August 16, 2019

WAP to check whether the year is leap or not.

// Program
//The year which is divisible by 400,100 and 4 is called leap year.

#include<stdio.h>
void main()
{
     int a,year;
     printf("Enter any year:");
     scanf("%d",&year);
     if((year%400)==0)
     {
            printf("Leap year");
      }
     else if((year%100)==0)
     {
            printf("Leap year");
      }
     else if((year%4)==0)
     {
            printf("Leap year");
     }
     else
            printf("Not leap year");
     getch();
}

Sample Input/Output:

Enter any year:2004
Leap year

No comments:

Post a Comment

Write a program to find gcd of two numbers using recursion.

About:  The process in which a function calls itself is called recursion and the corresponding function is called as recursive function. ...