[Solved] Sum of digits at Even and Odd Places in C
[ad_1] Here is a solution for your problem: void main() { int n,m,oddSum=0,evenSum=0; printf(“Please insert the number for the program:”); scanf(“%d”,&n); int flag=0; int counter=1; while (n!=0) { if(counter%2==0) { evenSum += n % 10; n /= 10; } else { oddSum += n % 10; n /= 10; } counter++; } if(counter%2==0) { int … Read more