Actually, mine crapped out at the last bit. Maybe I'm doing this wrong though.
Code:
#include <stdio.h>
#include <math.h>
int main() {
unsigned long foo = 0, count; // I also tried just long foo
for (count = 0; count < 32; count++) {
foo += pow(2, count);
printf("%d \n", foo);
}
return 0;
}
Output:
Code:
1
3
7
15
31
63
127
255
511
1023
2047
4095
8191
16383
32767
65535
131071
262143
524287
1048575
2097151
4194303
8388607
16777215
33554431
67108863
134217727
268435455
536870911
1073741823
2147483647
-1 // I guess the max should be 4294967294