program to check whether the year is a leap year or not without using the logical operator
c4fun
Looking for making to make a program to find the year ,and check it is the given year is leap year then you would be looking for some logic behind the concept ,
You may think how to find out the year , what all steps. Would be required to find logic behind the concept .
What is the also you should follow to make the program to run properly and display the results as you have thought .
C4FUN
is going to show you, How to go with the Program to Check Year given is or Not leap year
Before we start
, Let understand the logic behind the Leap Year normally
year has 365 days which we all know! but a leap year has 366 days. This extra day is included in February month, and we get February as 29. years which are divisible by 4 are termed as Leap years except the century years.what are century years? Century year means they end with 00 For such years we have to calculate further Below is the source code for you to help you out .
year has 365 days which we all know! but a leap year has 366 days. This extra day is included in February month, and we get February as 29. years which are divisible by 4 are termed as Leap years except the century years.what are century years? Century year means they end with 00 For such years we have to calculate further Below is the source code for you to help you out .
#include<stdio.h>
#include<conio.h>void main()
{
int yr;
clrscr();
printf("\n enter year\n");
scanf("%d",&yr);
if(yr%400==0)
{
printf("\n %d is leap year");
}
else
{
if(yr%4==0)
{
if(yr%100!=0)
{
printf("\n %d id leap year",yr);
}
else
{
printf("\n %d is not leap year",yr);
}
}
else
{printf("\n%d is not a leap year");
}
}
getch();
}
The output we get :
Enter a year 1600 1600 LEAP YEAR.
So now when you have done coding and ready to move on its time to share your experiences
How was the program ? Was it running as you have expected ?
Were you able to modify the program as you were asked to do ?
Share the blog with your friends and help them to know the program and methods they should go with to make a simple logic program !!!.
As c4fun believe in sharing is caring method will request you to share to your friends..
If you have any questions or any doubt you may comment below the query it would be answered as soon as possible .
Leave a Comment