Thursday, September 4, 2014

Write a function to determine whether the year is a leap year or not.


Problem

Any year is entered through the keyboard. Write a function to determine whether the year is a leap year or not.

Solution - Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void lp_yr();
main()
{
 lp_yr();
 system("pause");
}
void lp_yr()
{
 int x,y;
 printf("Enter any year : ");
 scanf("%d",&x);
 if (x%4==0)
  printf("entered year is leap\n");
 else
  printf("enterd year is not leap\n");
}

Sample Output

leap year or not in c language

No comments :

Post a Comment

Note: Only a member of this blog may post a comment.

Copyright 2017. All Rights Reserved. Privacy Policy / Terms And Conditions / Sitemap / Contact