0
What is wrong in this code?
2 Answers
+ 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;
}
0
Then also it is not working