#include <stdio.h>
#include <stdlib.h>
int main()
{
// we must declare the number names
int n;
printf("Enter the number of names: ");
scanf("%d", &n);
// we declare the array which consist of string names
char *names[n];
// We enter names for each number
for (int i = 0; i < n; i++) {
printf("Enter %d - name: ", (i + 1));
scanf("%s", &names[i]);
}
// we can see the each names with their scores
// last step is define the highest and lowest scores
for (int i = 0; i < n; i++) {
printf("%s - ", &names[i]);
fillArray();
printf("\n");
}
return 0;
}
// we fill the names with scores so we create a function for it
int fillArray () {
int arr[5];
int max = 0, min = 100;
for (int i = 0; i < 5; i++) {
arr[i] = rand() % 100;
if (max < arr[i]) {
max = arr[i];
}
if (min > arr[i]) {
min = arr[i];
}
printf("%d ", arr[i]);
}
printf("\n%d - is highest score and %d - is the lowest score", max, min);
}
The proof is that the image which taken from console
Comments
Leave a comment