Question: C++ Write a C++ program that displays, 10 per line, all the leap years from the year 1600 (inclusive) to 2100 (inclusive). The years are
C++
Write a C++ program that displays, 10 per line, all the leap years from the year 1600 (inclusive) to 2100 (inclusive). The years are separated by exactly one space. Also display the number of leap years in this period. Note that there is no input from the user. Hint: write a loop to examine all integers from 1600 to 2100. Check if that integer is a leap year. If it is, display it and increment a counter. Every time you display 10 integers, print a new line. You can use the following expression to check whether year is leap or not: bool isLeapYear = (year % 4: == 0 && year % 100 != 0) || (year % 400 == O); Grading rubric: 1. correct years displayed (60%) 2. correct number of leap years (20%) 3. correct output format (10 per line) (20%)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
