problem with the programme!!
- by hopefulLLl
kindly tell me what is the pblm with this function wont it help me find the sum of digits of a number??
#include<stdio.h>
#include(math.h)
void main()
{
int a,i=0,j=10,k,n=0,m;
scanf("%d",&a);
while((a%j!=0)&&i>=0)
{
m=pow(10,(i+1));
k=a%m;
n=(a-(k*m)-n)/(m/10)+n;
j=m*10;
i++;
}
n=n+(n/(m/10));
printf("%d",n);
}
i know the parenthesis used with math.h are nt right..what else is the pblm..i need to use just while loop..or the for loop!