Skip to content

Instantly share code, notes, and snippets.

@tomcha
Created January 12, 2015 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomcha/eb407ce02a96e111fbc1 to your computer and use it in GitHub Desktop.
Save tomcha/eb407ce02a96e111fbc1 to your computer and use it in GitHub Desktop.
intpow
#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