so I have this code:
int in = 496;
boolean b = true;
Sting s = "":
if (b) {
int test = 0;
System.out.print(in + ":");
for (int i = 1; i < in; i++) {
if (in % i == 0) {
test += i;
s += i + " ";
}
}
System.out.println(" ");
} else {
System.out.println(in + " no factorials");
}
and it prints like this:
496:1 2 4 8 16 31 62 124 248
but I want to revers the factorials output to look like this:
496:248 124 62 31 16 8 4 2 1
I tried to reverse the for loop, but it work, so any ideas guys?