# to check if its leap year

, ,

any year is input through the keyboard. write a program to determine wheter it’s a leap year or not?

1. Using modulus operator.
2. Using && amd || operators.

@rahul_kasana It looks like you are trying to get us to do your homework for you. This is a simple code but you will never learn to code if we keep doing your homework for you. I will give you the algorithm you need to follow. You can code it up yourself. If you have any problems, we can help you in debugging.

Algorithm:

To determine whether a year is a leap year, follow these steps:

`````` 1) If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5.
2) If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4.
3) If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5.
4) The year is a leap year (it has 366 days).
5) The year is not a leap year (it has 365 days).``````
2 Likes

in college we dont get homework im new to coding so doesn’t know how to use modulus operator just this. btw thanks for the help.
but how will it determine if year has 365 or 366 days just from the year entered? im mean how can it determine from year1966 whether it has 365 days or 366

#include<stdio.h>
#include<conio.h>
void main()
{int a;
printf(“enter the year of your choice\n”);
scanf("%d",&a);
if(a%4==0)
printf("%d is a leap year\n",a);
else
printf("%d is NOT a leap year\n");
getch();
}

``````year is evenly divisible by 4
``if ( year%4 == 0 )``