Answer:
#include <stdio.h>
#include <stdbool.h>
bool IsArrayMult10(int inputVals[], int numVals) {
for (int i = 0; i < numVals; i++) {
if (inputVals[i] % 10 != 0) {
return false;
}
}
return true;
}
bool IsArrayNoMult10(int inputVals[], int numVals) {
for (int i = 0; i < numVals; i++) {
if (inputVals[i] % 10 == 0) {
return false;
}
}
return true;
}
int main() {
int size, input;
scanf("%d", &size);
int arr[size];
for (int i = 0; i < size; i++) {
scanf("%d", &input);
arr[i] = input;
}
if (IsArrayMult10(arr, size)) {
printf("all multiples of 10\\");
} else if (IsArrayNoMult10(arr, size)) {
printf("no multiples of 10\\");
} else {
printf("mixed values\\");
}
return 0;
}
Step-by-step explanation:
The program first defines two functions IsArrayMult10 and IsArrayNoMult10 which take an array of integers and the size of the array as parameters and return a boolean indicating whether the array contains all multiples of 10 or no multiples of 10, respectively.
In the main function, the program first reads the size of the list from standard input, then reads the list values one by one and stores them in an array. Finally, it calls the two functions to determine whether the list contains all multiples of 10, no multiples of 10, or mixed values, and prints the appropriate output.