Advertisement
Joao_Joao

Questão 257 Lista de Exercícios IFPB

May 21st, 2022
692
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data Copied
Advertisement