(Digits of an Integer) Write a program that inputs a five-digit integer, separates the integer 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 pro- gram should print:

4 2 3 3 9
What will be an ideal response?

```
#include // allows program to perform input and output
using namespace std; // program uses names from the std namespace

int main()
{
int number; // integer read from user

cout << "Enter a five-digit integer: "; // prompt
cin >> number; // read integer from user

cout << number / 10000 << " ";
number = number % 10000;
cout << number / 1000 << " ";
number = number % 1000;
cout << number / 100 << " ";
number = number % 100;
cout << number / 10 << " ";
number = number % 10;
cout << number << endl;
} // end main
```

Computer Science & Information Technology

You might also like to view...

The Revisions pane displays comments and changes made in the copy

Indicate whether the statement is true or false

Computer Science & Information Technology

A risk in using linked videos is problems with missing or ________ links

Fill in the blank(s) with correct word

Computer Science & Information Technology