Answer to Question #292863 in C++ for Rubie Ann

Question #292863

Create a program that will call rand() function plus 5 and prints its return value 13 times on the screen using a for loop.

1
Expert's answer
2022-02-01T11:58:59-0500
#include <iostream>
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */
using namespace std;


int main(){


	srand (time(NULL));


	for(int i=0;i<13;i++){
		int number= rand() % 100;
		number+=5;
		cout<<number<<"\n";
	}




	system("pause");
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment