#include <stdio.h>

int main(void) {

    unsigned int i_test;
    int i;
    unsigned long pow = 1;
    int size = 64;
    int show = 1;
    int sign = 0;
    
    for (i = 1; i <= size; i++) {
        pow = pow * 2;
        i_test = pow - 1;
        if (i>sizeof(i_test)*8-sign && show) {
            printf("overflow\n");
            show = 0;
        }
        printf("2^%d-1 = %ld\n", i, (long)i_test);
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: