Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int potencia(int x, int y)
- {
- int aux = x;
- int pot = x;
- for (y=1; y<=x; y++) {
- pot = x * aux;
- x = pot;
- }
- return pot;
- }
- int main ( void ) {
- int x, y;
- printf( "Insira a base e o expoente: " );
- scanf( "%d %d", &x, &y );
- printf( "O resultado: %d", potencia( x, y ) );
- return 0;
- }
Add Comment
Please, Sign In to add comment