This is an alternate pow func problem
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int us(int a,int b){
int d,e,*f;
for(int c=0;c<b;c++){
if(b==2)
d=a*a;
if(b==0){
goto git;
}
if(b==1)
d=a;
if((b>2))
{
d=a*a;
e=d;
d=e*a;
}
return d;
git:
printf("%i",(b+1));
}
}
int main(){int g,h;
cin>>g;
cin>>h;
cout<<us(g,h)<<endl;
system("PAUSE");
return 0;}
|
This is run.But my problem is at 3^0 2^0
I can not calc a^0 by PC.
Last edited on
Topic archived. No new replies allowed.