C Write Program Generates Prints 24 Random Values Using Array Rand Function Implement Algo Q37038148

C++

Write a program that generates and prints 24 random values usingan array and the rand () function.
Implement an algorithm to find the maximum and a minimum number ofrandom numbers generated.
Use the header “#include <ctime>”, “#include <cstdlib>”in addition to the usual header: “#include<iostream>”


Solution


#include <iostream>#include <cstdlib>#include <ctime>using namespace std;int main() { srand(time(NULL)); int arr[24]; for (int i = 0; i < 24; ++i) { arr[i] = rand(); } int min = arr[0], max = arr[0];

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.