#include #include #include int main() { #define MAX_A_SIZE 256 int num, val, counter = 0; char msg[MAX_A_SIZE]; printf("Insert a positive integer value\n"); if ( scanf_s("%d", &num) != 1) { perror("Error reading the big even number"); return(1); } printf("Insert a sequence of positive integers(0 to terminate) :\n"); memset(msg, '\0', MAX_A_SIZE); do { if ( scanf_s("%d", &val) != 1) { perror("Error reading the big even number"); return(2); } if (val != 0 && (val % 2) == 0 && (num % val) == 0) { counter++; sprintf_s(msg + strlen(msg), MAX_A_SIZE - strlen(msg), "%d, ", val); } } while (val != 0); msg[strlen(msg) - 2] = '\0'; printf("The even values divisors of %d are %d: %s", num, counter, msg); return 0; }