I\'m trying to learn c++ on my own and I\'ve hit a bit of a road block. The problem is I need to take an integer,split it into its digits and get the sum of the digits and
I used this for input for 5 numbers
int main () {
using namespace std;
int number;`
cout << "Enter your digit: ";
cin >> number;
if (number == 0)
return 0;
int a = number % 10;
int second = (number / 10);
int b = second % 10;
int third = (second / 10);
int c = third % 10;
int fourth = (third / 10);
int d = fourth % 10;
int fifth = (fourth / 10);
int e = fifth % 10;
cout << e << " " << d << " " << c << " " << b << " " << a << endl;
return 0;
}