Question #189003

Expert's answer

```
#include<iostream>
using namespace std;
int main() {
int num;
int sum_digits=0;
cout << "Enter a number : ";
cin >> num;
while (num != 0)
{
sum_digits = sum_digits + num % 10;
num = num / 10;
}
cout << "The sum of the digits is : "<< sum_digits<<endl;
return 0;
}
```

Learn more about our help with Assignments: C++

## Comments

## Leave a comment