C Program to Add Digits of Number
//WAP TO ADD DIGITS OF THE NUMBER #include <stdio.h> int main() { long int n; int sum = 0, digit; printf("Enter the number :--> "); scanf("%ld", &n); while(n != 0) { digit = n % 10; sum = sum + digit; n = n / 10; } printf("The sum of the digits is :--> %d", sum); return 0; }