close

#include <stdio.h>
#include <stdlib.h>


//function
void countPow(int x, int p);

int main(int argc, char *argv[]) {
//2的20次方
countPow(2,20);

return 0;
}



//次方
void countPow(int x, int p){
int power = x, i;
for(i =0 ; i<p-1 ; i++){

power *=x;
}

printf("%i的%i次方為%i", x, p, power);
}

arrow
arrow
    全站熱搜

    kenohya 發表在 痞客邦 留言(0) 人氣()