Write A function to find sum of digit of a number in c (without used of +)

 // Write A function to find sum of digit of a number in c (without used of +)

#include <stdio.h>

int main()

{

int n,sum=0,m;

printf("Enter a number: ");

scanf("%d", &n);

while(n>0)

{

m=n%10;

sum=sum+m;

n=n/10;

}

printf("sum is =%d", sum);

return 0;

}

Comments

Popular posts from this blog

Automations and robotics

Solid Pattern Program In Java Language

Palindrome Pattern Program In Java Language