Question: Practise Problem 1: Write a program to include the condition to check if a year is leap or not. Please modify the program given in
Practise Problem 1: Write a program to include the condition to check if a year is leap or not. Please modify the program given in Exercise 1. Instead of taking a character input in case of the month of the February, the user should input the year. The year value should be if it belongs to a leap year category or not, and accordingly the output should be displayed.
Note: The numeric input for satisfying the leap year condition should be true in atleast one of the cases given below.
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).
The flow-chart for checking a numeric input for leap year condition looks like this.
Practise Problem 2: Write a program to find the maximum from a sequence of ten numbers. Your program should take 10 real numbers as user input. You can select double as the datatype for reading the numbers as input. The program should also print the position of maximum number in the sequence.
Note: You can follow this flow-chart to write the program
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
