I still can't figure out how to display the factors backwards. Tried playing with the algorithms but ending up with errors. lol. Please someone help me.
#include <iostream>
using namespace std;
int main ()
{
int counter;
int fnum;
cout<<" Please input a number and press [ENTER].";
cin>>fnum;
for (counter=1;counter<=fnum;counter++)
{if (fnum%counter==0)
cout<<counter<<endl;
}
return 0;
}
For example , If I input 36 , and the output would be 1 , 2 , 3 , 4 , 6 , 9 , 12 , 18 , 36. But how can i make it to display the other way around?