Factoring

How would i get this to print out in descending order?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
using namespace std;

int main()
{
    int n,i;
  cin >> n;
 
  for(i=1;i<=n;++i)
  {
      if(n%i==0)
         cout << i << endl;
  }
    return 0;
}
for(i=n;i>=1;--i)
Yup that worked! Thanks so much!!!
Topic archived. No new replies allowed.