Advertisement
Joao_Joao

Questão 257 Lista de Exercícios IFPB

May 21st, 2022
799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int pot(int base, int expoente) {
  4.   if(expoente == 0) return 1;
  5.   if(expoente == 1) return base;
  6.   return base * pot(base, expoente-1);
  7. }
  8.  
  9. void main() {
  10.   int base, expoente;
  11.   scanf("%d%d", &base, &expoente);
  12.   printf("Valor da potenciacao: %d\n", pot(base, expoente));
  13. }
  14.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement