I'm having trouble with this program the objective is to Prompt the for a int. from 0-999, then split the int into three digits, then output the three digits from 000 through number entered using 3 nested for loops. I can get the second and last digits to work but I can't figure out what if statement(s) I need to use, so the program will work. Here is what I have so far:

int main()

{

int number, c, d, e;

cout << "Enter a Positive Integer from 0 to 999." << endl;

cin >> number;

while ((number < 0) || (number > 999))

{

cout << "Error: Negative Number or Number Greater than 999\n" << "Reenter that number and continue: \n";

cin >> number; }

c = number / 100;

d = (number % 100 - number % 10) / 10;

e = number % 10;

for ( int k= 0 ; k <= c ; k++)

for (int i = 0; i <= d ; i++)

for ( int j= 0; j <= e ; j++)

cout << k << i << j << endl;

return 0;

}