Write an algorithm and draw a flowchart to input year and check whether it is leap year or not. (A year is leap year if year%400=0
Please help guys
Answers
Answered by
17
Answer:
Algorithm
Algorithm of this program is −
START
Step 1 → Take integer variable year
Step 2 → Assign value to the variable
Step 3 → Check if year is divisible by 4 but not 100, DISPLAY "leap year"
Step 4 → Check if year is divisible by 400, DISPLAY "leap year"
Step 5 → Otherwise, DISPLAY "not leap year"
STOP
Flow Diagram
We can draw a flow diagram for this program as given below −
Attachments:
Answered by
0
Leap Year is divisible by 4 or 400 and is not to be divisible by 100.
Explanation:
- The condition to verify if the given year is a leap year or not the following condition must be true:
let 'x' be the year.
- x should be divisible by 4 or 400.
- x should necessarily not be divisible by 100.
Following shows the true condition for leap year:-
if((x % 400==0 )||(x%4==0 && x%100!=0))
{
//Statements
}
else
{
//Statements
}
Similar questions