return 0;
}
int display(int x, int y, int z)
{
printf("\n\n");
printf("The min value is %d.\n", x);
printf("The max value is %d.\n", y);
printf("The total of numbers is %d.\n", z);
}
void heading()
{
printf("This program generates 5 random numbers and stores them in an array.\n");
printf("Then determines which number is largest and smallest.\n\n");
}
# include <stdio.h>
# include <stdlib.h>
# include <time.h>
# include <limits.h>
#define SIZE 5
int random(int);// You send only one value so you need one argument
void display(int, int, int);
void heading();
int main()
{
heading();
random(SIZE);
return 0;
}
int random(int sz)
{
int counter = 0,sum = 0,arr[sz];
int mx = INT_MIN, mn = INT_MAX,num = 0;
srand(time(NULL));
for(counter = 0;counter < sz;counter++)
{
num = 1 + rand() % 51;
printf("%d ", num);
arr[counter] = num;
if(num < mn)
mn = num;
if(num > mx)
mx = num;
sum = num + sum;
}
display(mn, mx, sum);
return 0;
}
void display(int x, int y, int z)
{
printf("\n\n");
printf("The min value is %d.\n", x);
printf("The max value is %d.\n", y);
printf("The total of numbers is %d.\n", z);
// Return something or void this function
}
void heading()
{
printf("This program generates 5 random numbers and stores them in an array.\n");
printf("Then determines which number is largest and smallest.\n\n");
}