google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 leap year program in c using if else - 2nd puc computer science

leap year program in c using if else

write a c program to check leap year,how to leap year in c,write a c program to check whether a year is leap year or not,leap year program in c,write a program to check if the year entered by the user is a leap year or not

leap year program in c using if else

#include<stdio.h>

#include<conio.h>

void main()

{

int year;

clrscr();

printf("Enter the year: ");

scanf("%d",&year);

if(year%4==0&&year%100!=0||year%400==0)

printf("%d is a leap year",year);

else

printf("%d is not a leap year",year);

getch();

}

Output:

 

run 1:

Enter the year: 2020

2020 is a leap year

 

run 2:

Enter the year: 2021

2021 is not a leap year


leap year program in c using if else leap year program in c using if else Reviewed by Vision Academy on December 18, 2021 Rating: 5

No comments:

CheckOut

Powered by Blogger.