answersLogoWhite

0


Best Answer

#include
#include

void main()
{

long n,s=0,t,d;
clrscr();

cout << "Enter a number : ";
cin >> n;

t=n;

while(n>0)
{
d=n%10;
s=s+d;
n=n/10;
}

cout << "Sum of " << t << " is " << s << endl;

getch();
}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the Programme to calculate the sum of a five digit number?
Write your answer...
Submit
Still have questions?
magnify glass
imp