write a c program to find leap year or not, using nested if-else - CodeTextPro | Web Tutorial | Technology

CodeTextPro.com Provides - Web design, Technology gyan, Digital marketing, Online earnings, Seo, Adsense, Technology news, Motivation and inspiration, Latest Technology Affairs, Gadgets, Blogging

Saturday, January 5, 2019

write a c program to find leap year or not, using nested if-else

Find leap year or not, using nested if-else 

#include<stdio.h>
#include<conio.h>
void main()
{
int year;
clrscr();
printf("\n Enter Year");
scanf("%d",&year);
if((year % 100) == 0)
{
  if((year % 400) == 0)
   {
    printf("\n Year %d is Leap ",year);
   }
  else
   {
    printf("\n Year %d is Not Leap ",year);
   }
}
else
{
  if((year % 4) == 0)
  {
   printf("\n Year %d is Leap ",year);
  }
  else
  {
   printf("\n Year %d is Not Leap ",year);
  }
}
getch();

}

No comments:

Post a Comment