10th Feb 2020, 3:59 PM
Virendra Maurya
Virendra Maurya - avatar
2 Antworten
+ 3
If you just wanted to add all digits then this will work fine. #include<stdio.h> int main() { int a,b,s=0; scanf("%d",&a); // missing & while(a>0) { b=a%10; a/=10; s+=b; } printf("%d",s); return 0; }
10th Feb 2020, 4:08 PM
Avinesh
Avinesh - avatar
0
Then also it is not working
11th Feb 2020, 2:19 AM
Virendra Maurya
Virendra Maurya - avatar