//program developed by Ismail Mohamed - Date 9/14/24#include <stdio.h>#include <stdlib.h>#define SIZE 5 //Function prototype declarationsvoid udfDisplayArray(int intArr[], int size);//function prototype int main() { int intArray[SIZE] = {0};//initially all elements int i, n, randN, max, sum = 0; double average;//system("cls");//system call to the operating systemprintf("program enhanced by ismail Mohamed. Date: 9/14/24\n");printf("Enter random number maximum value > 0: "); //INPUTscanf("%d", &max);if (max >0) { //PROCESSING for(i=0; i < SIZE; ++i) { randN = rand() % (max+1); intArray[i] = randN; sum += intArray[i]; }//for //udfDisplayArray(intArray, SIZE); //Function call output average = (double) sum / SIZE;}//ifprintf("Average = %.21f", average); //OUTPUTprintf("\n End of program\n"); return 0;}//main add a while loop of 10>100>1000
//program developed by Ismail Mohamed - Date 9/14/24
#include <stdio.h>
#include <stdlib.h>
#define SIZE 5
//Function prototype declarations
void udfDisplayArray(int intArr[], int size);//function prototype
int main() {
int intArray[SIZE] = {0};//initially all elements
int i, n, randN, max, sum = 0;
double average;
//system("cls");//system call to the operating system
printf("program enhanced by ismail Mohamed. Date: 9/14/24\n");
printf("Enter random number maximum value > 0: "); //INPUT
scanf("%d", &max);
if (max >0) { //PROCESSING
for(i=0; i < SIZE; ++i) {
randN = rand() % (max+1);
intArray[i] = randN;
sum += intArray[i];
}//for
//udfDisplayArray(intArray, SIZE); //Function call output
average = (double) sum / SIZE;
}//if
printf("Average = %.21f", average); //OUTPUT
printf("\n End of program\n");
return 0;
}//main
add a while loop of 10>100>1000
Step by step
Solved in 2 steps