Hello,
I have written in C a program that calculate the sum of digits (for a number).
For Example for the number 199 the checksum is 19.
But now i want that my program also calculate the checksum of 19.
How can i do that in C? Can i make a nested function in C?
Here is my code
Code:int dsum(int z)
{
int q=0;
while(z>0)
{
q+= z%10;
z /=10;
}
return q;
}
int main(){
int z =199;
int i;
int qs= dsum(z);
printf("%d", qs);
return 0;}