fork(1) download
  1. #include <stdio.h>
  2. double power(double x,int n){
  3. double p=1;
  4. int i;
  5. for(i=1;i<=n;i++)
  6. p=p*x;
  7. return p;
  8. }
  9. int main(void) {
  10. double x;
  11. int n;
  12. double m;
  13. scanf("%d%d\n",&x,&n);
  14. m=power(x,n);
  15. printf("%d的%d次方是:%d",x,n,m);
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 5352KB
stdin
  6.0 2
stdout
21958的21959次方是:1174962183