Skip to content

Instantly share code, notes, and snippets.

@jagdish4501
Created April 1, 2021 19:26
Show Gist options
  • Save jagdish4501/d8cdcbc3a35474b5adbc0765fcf4e465 to your computer and use it in GitHub Desktop.
Save jagdish4501/d8cdcbc3a35474b5adbc0765fcf4e465 to your computer and use it in GitHub Desktop.
Any year is entered through the keyboard, write a program to determine whether the year is leap or not.
#include <stdio.h>
int main()
{
int year;
printf("Enter year :");
scanf("%d", &year);
if ((year % 4) == 0)
{
if ((year % 100) == 0)
{
if ((year % 400) == 0)
{
printf("year %d is a leap year", year);
}
else
printf("year %d is not a leap year", year);
}
else
printf("year %d is a leap year", year);
}
else
printf("year %d is not a leap year", year);
return 0;
}
---->> 𝙢𝙚𝙩𝙝𝙤𝙙 2
#include <stdio.h>
int main()
{
int y;
printf("Enter year :");
scanf("%d",&y);
if((y%4)==0)
{
((y%100)==0)?(((y%400)==0)?printf("leap year"):printf(" not leap year")):printf("leap year");
}else
printf(" not leap year");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment