Question: Exercise 2 : Write a C + + program that does the following ( explain the code using comments ) : Prompts the user to

Exercise 2:
Write a C++ program that does the following (explain the code using comments):
Prompts the user to enter a number N (positive integer).
Prints all the even numbers (think of the return value of the division) from 1 to N using a for loop.
For each even number, check if it is divisible by 4(i.e. return value of the division is null) using an if statement. If it is, print that it is divisible by 4, otherwise, print that it is not.
Exercise 2 : Write a C + + program that does the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!