Code:
#include <stdio.h> #include <stdlib.h> void separate(int *first, int *second, int *third); int main() { int number; int A, B, C; printf("Enter a positive integer value to be evaluated: "); scanf(" %d", &number); A = number + 0; B = number + 0; C = number + 0; printf("\nThe integer value you've chosen is %d\n\n", number); separate(&A, &B, &C); printf("The value of A is %d\n\n", A); printf("The value of B is %d\n\n", B); printf("The value of C is %d\n\n", C); system("pause"); return 0; } void separate(int *first, int *second, int *third) { int i, j; int input, sum = 0, total_sum = 0; if (*first % 7 == 0 || *first % 11 == 0 || *first % 13 == 0) { *first = 1; } else { *first = 0; } for (i = *third; i > 1; i--) { if (*third % i == 0) { *third = 0; } else *third = 1; } // The problem is somewhere for here on //Im trying to add the digits of my imputed variable and return them to my main //function. for (input = *second; input <= 1000; input++) { sum = 0; for (j=0; j<4; j++) { sum = sum + (input / (j*10))%(10) ; } total_sum = total_sum + sum; } *second = total_sum; }
Comment