Question: C++ Write three ( 3) for loop statements in the main that perform the following one-dimensional array operations on a 10-element double array called a.

C++

Write three (3) for loop statements in the main that perform the following one-dimensional array operations on a 10-element double array called a. That is,

const int size = 10; double a[size];

In a for loop, populate each element to 7.7. Print the array. In a for loop, populate each element with a random decimal from 0.0 to 1.0. Print the array. In a for loop, set each element to sequential multiples of 0.5, that is {0.5, 1.0, 1.5, 2.0, 2.5,...}. Print the array.

Write three (3) more for loop statements in the main. Declare anther integer array called b:

int b[size];

In a for loop, populate this array b with the even integers {2,4,6,8,...}. Print the array. In a for loop, add all the even numbers in the previous array b. Print the sum. In a for loop, print the previous array b backwards.

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 Databases Questions!