Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

programming language meu-VIUWUcune tud=2443897171&course id= 183 // Lab 3 // Description: Write a program that will find the sum of the even numbers of //

programming language

image text in transcribed

meu-VIUWUcune tud=2443897171&course id= 183 // Lab 3 // Description: Write a program that will find the sum of the even numbers of // a sequence from the starting point to the end. // // 1. Declare the needed variables // 2. Collect the user input (a - first term, b-last term) // Note: IF the last term is smaller than the first andil and put out a message informing the user // 3. Find the sum of the odd terms ONLY.. (Use a loop) // 4. Print the sum. // // Note: For example, if a = 1, b - 9 then the sequence is: 2 + 4 + 6 + 8 and the sum - 20 // // if a - 8, b - 10, then the series is 8 + 10 and the sum - 18 // #include using namespace std; // Header file needed for I/O // Line used for simplicity int main() 7 1. Declare the variables needed for this program. // Use a, d, n and sum as integers // You may declare other variables as needed int a, b; int sum = 0; // Must be initialized to zero 1/ 2. Collect the user input needed cout > a; cin >> b; // Check if the first term is bigger than then the last // if it is put out the message: "First bigger than last" // otherwise go to step 3. // 3. Once the input is entered, use a loop to find the sum of the EVEN numbers // 4. Print the sum cout

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