Question: Create a C++ code using a for loop which calculates the sum of Z integers inputted by a user . Z is a random number

Create a C++ code using a for loop which calculates the sum of Z integers inputted by a user. Z is a random number which is computer generated. Z is between 5 and 15 (both included).

Use the these libraries for rand(),srand(), and time() support.

#include #include

setting seed: srand(time(NULL))

Use this for generating a random number: rand()

BELOW IS THE CODE I HAVE CREATED. PLEASE ALSO EXPLAIN WHY IT IS NOT OUTPUTTING THE CORRECT OUTPUT

Create a C++ code using a for loop which calculates the sum

Einclude 2 #include (#includectime> using namespace std; int main() { 4 9 10 int num; int sum = 0; int N; 12 13 14 15 16 17 18 19 20 211 1 srand (time (NULL)); for (int N -5 rand () % 6; N.(2* N); ++N) + cout 33 "Enter " 5 N cin >>num; 2B 24 25 26 27 28 29 30 1 32 integers :

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!