# include #include int main() { #define MAX_A_SIZE 100 // size of the array where entered decimal values will be managed int num[MAX_A_SIZE]; int val, counter = 0, total = 0; printf("Insert a serie of positive integers (0 to terminate) :\n"); do { if (scanf_s("%d", &val) != 1) { perror("Error reading integer value"); return(1); } if (val > 0) { //total++; num[total++] = val; if (val % 3 == 0 || val % 5 == 0 || val % 7 == 0) { counter++; //printf("%d\t", val); } } } while (val != 0); bool ordered = true; do { ordered = true; for (int i = 0; i < total-1; i++) { if (num[i] > num[i + 1]) { val = num[i]; num[i] = num[i + 1]; num[i + 1] = val; ordered = false; } } } while (!ordered); printf("Total number of entered numbers is %d\n", total); printf("Number of multiples of 3 or 5 or 7 is %d\n", counter); // print the ordered list printf("Ordered list:\t%d", num[0]); for (int i = 1; i < total; i++) { printf(", %d", num[i]); } printf("\n"); return 0; }