Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 total 0 ( set total to 0 ) 2 FOR EACH number IN list 3 { 4 IF ( EVEN ( number ) )

1 total 0(set total to 0)
2 FOR EACH number IN list
3{
4 IF(EVEN(number))
5{
6 total total + number (Set total to the current total + number)
7}
8}
9 DISPLAY(total)1)Which line(s) of the algorithm contains a repetition control structure? Remember a control structure can consist of multiple statements.
Which line(s) of the algorithm contains a selection control structure?
If you run this algorithm on the list of numbers (5,10,-2,-3,7,8,12), what would it print? When tracing through an algorithm, write down the variables (total and number) and act as if you are the computer executing each line of code and change the values of the variables as needed.
Suppose you had a list of positive numbers such as 5,10,12,13,6,7,1,3,2,1. And suppose for each of the numbers in the list you added the number to a running total if it is even and subtracted it if it is odd, starting the total at 0. What result would you get for this list of numbers?
Write a pseudocode algorithm that implements the algorithm you used to calculate this total.
Create a flowchart that correlates to your pseudocode algorithm

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

Explain how psychologists study health and wellness.

Answered: 1 week ago

Question

Group Size and Communication

Answered: 1 week ago

Question

Understanding Group Roles

Answered: 1 week ago