Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ please C. Using the For loop Just like the while and the do-while loop, a for loop allows you to repeat your codes

In C++ please image text in transcribed

C. Using the For loop Just like the while and the do-while loop, a for loop allows you to repeat your codes for the desired number of times. In this exercise, we will write a program to find the sum of all even numbers between any two randomly generated numbers, the randomly generated numbers are also included in the sum, if they are even. For example, if the randomly generated integers are 5 and 12, you need to sum from 6 to 12. Another example: if the randomly generated integers are 10 and 18, you need to sum from 10 to 18. In this program, you will: Generate a first random integer between 1 and 10, inclusive. Generate a second random integer between 11 and 20, inclusive. Inside a for loop, compute the sum of all even numbers between the two random numbers generated, the random numbers included in the sum if they are even. Display the random numbers as well as the sum on the screen with suitable messages

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions