0% found this document useful (0 votes)
53 views1 page

EX - NO:3 Date: Write A Program To Find Whether The Given Year Is Leap Year or Not

The document describes a program to determine if a given year is a leap year or not. The program prompts the user to input a year, then uses the modulo operator and a series of if/else statements to check if the year is divisible by 4, 100, and 400 to identify if it is a leap year or not, then prints the result. The aim, algorithm, program code, and result are provided to explain how the program works to solve the problem.

Uploaded by

jeeva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views1 page

EX - NO:3 Date: Write A Program To Find Whether The Given Year Is Leap Year or Not

The document describes a program to determine if a given year is a leap year or not. The program prompts the user to input a year, then uses the modulo operator and a series of if/else statements to check if the year is divisible by 4, 100, and 400 to identify if it is a leap year or not, then prints the result. The aim, algorithm, program code, and result are provided to explain how the program works to solve the problem.

Uploaded by

jeeva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

EX.

NO:3 WRITE A PROGRAM TO FIND WHETHER THE GIVEN YEAR IS LEAP YEAR OR
NOT.
DATE:

AIM:
To Write a program to find whether the given year is leap year or not.

ALGORITHM:
1.Start the program.
2.Read Year.
3.IF Year%4=0.
Step-3.1 IF Year%100=0.
Step-3.1.1 IF Year%400=0.
Step-3.1.2 Print “Leap Year”.
Step-3.1.3 ELSE Print “Not Leap Year.
Step-3.2 ELSE Print “Leap Year”.
4.Print “Not Leap Year”.
5.Stop.

PROGRAM:
#include <stdio.h>
#include<conio.h>
void main()
{
int year;
clrscr();
printf("Enter a year: ");
scanf("%d",&year);
if(year%4 == 0)
{
if( year%100 == 0)
{
if ( year%400 == 0)
printf("%d is a leap year.", year);
else
printf("%d is not a leap year.", year);
}
else
printf("%d is a leap year.", year );
}
else
printf("%d is not a leap year.", year);
getch();
}

RESULT:
Thus the program to find whether the given year is leap year or not was executed and the
output was verified.

You might also like