We have been asked this question a lot of times in our childhood by our parents
  or teachers that present year is leap or not. So, now you can solve this problem
  of yours through this program coded below.
  This program will take year as an input from user and will tell you whether year
  entered by you is leap year or not in the form of output.

  Logic:-  If you divide any year by 4 and it is totally divisible and gives
  remainder 0 then it's a leap year otherwise not. 

 Program
  
   #include <stdio.h>
   #include <conio.h> 
   void main()
   {
     int n,i,m=1;
     printf("Enter any year: ");
     scanf("%d",&n);
     if(n%4==0)
      {
        printf("%d is a leap year",n);
       }
      else
       {
        printf("%d is not a leap year",n);
        }
     }
 Output:
              Output when if part is true.                                            Output when if part is False.
                         

                                               << Back

Post a Comment

Previous Post Next Post