write a program that inputs a five-digit number, separates the number into its individual digits and prints the digits separated from one another by three spaces each. (Hint: Use the integer division and modulus operators.) For example, if the user types in 42339 the program should print 4 2 3 3 9
// Write a program that inputs a five-digit number, separates the number into its
// individual digits and prints the digits separated from one anotyher by three
// spaces each. (Hint: Use the integer division and modulus operator.) (for expample,
// if the user types in 42339 the program should print
// 4 2 3 3 9
// answer
#include <iostream>
usingnamespace std;
int main()
{
int a;
cout << "Enter a five-digit number: ";
cin >> a;
cout << a / 10000 << " ";
a = a % 10000;
cout << a / 1000 << " ";
a = a % 1000;
cout << a / 100 << " ";
a = a % 100;
cout << a / 10 << " ";
a = a % 10;
cout << a / 1;
return 0;
}
// compiled successfully with Orwell dev-cpp