I need a program same as I wrote but using loops. (if else for etc.) . Program is that enter a number and get each digits of number like that: number is 123456. I’m beginner, I can’t create the logic and can’t combine loops. Can anybody help me about that situation?

```
1.digits is 6
2.digits is 5
3.digits is 4
4.digits is 3
5.digits is 2
6.digits is 1
7.digits is 0
8.digits is 0
9.digits is 0
```

.

```
#include <iostream>
using namespace std;
int main()
{
int number,first,second,third,fourth,fifth,sixth,seventh,eighth,ninth;
cout<< "Enter a number (<999999999): " << endl;
cin>>number;
first = number%10;
second = number/10%10;
third = number/100%10;
fourth = number/1000%10;
fifth = number/10000%10;
sixth = number/100000%10;
seventh = number/1000000%10;
eighth = number/10000000%10;
ninth = number/100000000%10;
cout<<"1. digit is"<<" "<<first<<endl;
cout<<"2. digit is"<<" "<<second<<endl;
cout<<"3. digit is"<<" "<<third<<endl;
cout<<"4. digit is"<<" "<<fourth<<endl;
cout<<"5. digit is"<<" "<<fifth<<endl;
cout<<"6. digit is"<<" "<<sixth<<endl;
cout<<"7. digit is"<<" "<<seventh<<endl;
cout<<"8. digit is"<<" "<<eighth<<endl;
cout<<"9. digit is"<<" "<<ninth<<endl;
return 0;
}
```