#include <stdio.h>

int b = 2;
int N = 8; // le dichiarazioni si possono fare
            // anche all'esterno del main

int main() {
    int i,k; 
    int p;
    int S = 0;
    
    for(i=0;i<N;i=i+1) {
        printf("%d^%d = ",b,i);
        p=1;
        for(k=0;k<i;k=k+1) {
            p = p * b;
        }
        printf("%d\n",p);
        S = S + p;
    }
    printf("\n%d^%d = %d",b,N,S);
}

Embed on website

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