Guest User

Untitled

a guest
Aug 19th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1.     #include <stdio.h>
  2.  
  3. int potencia(int x, int y)
  4. {
  5.     int aux = x;
  6.     int pot = x;
  7.     for (y=1; y<=x; y++) {
  8.     pot = x * aux;
  9.     x = pot;
  10.     }
  11.     return pot;
  12. }
  13.  
  14.  
  15. int main ( void ) {
  16. int x, y;
  17.  
  18.         printf( "Insira a base e o expoente: " );
  19.        scanf( "%d %d", &x, &y );
  20.  
  21.         printf( "O resultado: %d", potencia( x, y ) );
  22.  
  23.  
  24.        return 0;
  25.  
  26. }
Add Comment
Please, Sign In to add comment