C++ Program to display the sum of a number's digits.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
cout<<"Enter a number to display sum of it's digits: ";
cin>>a;
b=a%10;
while(a!=0)
{
a=a/10;
c=a%10;
b=b+c;
}
cout<<"The sum of the digits is: "<<b;
getch();
}