#include <stdio.h>

// il valore x deve essere moltiplicato
// per se stesso n volte (n >= 0)
int pot(int x, int n) {
    int i,risultato = 1;
    for(i=1;i<=n;i++) {
        risultato = risultato * x;
    }
    return risultato;
}

int main() {
    int x = 3, n = 2;
    printf("%d^%d=%d\n",x,n,pot(x,n));
    x = 2; n = 3;
    printf("%d^%d=%d\n",x,n,pot(x,n));
    x = 1000; n = 0;
    printf("%d^%d=%d\n",x,n,pot(x,n));
}

Embed on website

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