Created
January 12, 2015 16:26
-
-
Save tomcha/eb407ce02a96e111fbc1 to your computer and use it in GitHub Desktop.
intpow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int int_pow(int x, int y); | |
int main(){ | |
printf("%d\n",int_pow(3,4)); | |
}; | |
int int_pow(int x, int y){ | |
if(y == 0){ | |
return 1; | |
}; | |
int def = x; | |
for(int i=1; i < y; i++){ | |
x *= def; | |
}; | |
return x; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment