Advertisement
campos20

Untitled

May 5th, 2020
1,244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. // Do-while
  6. // Autor: Alexandre Campos
  7.  
  8. int main()
  9. {
  10.     // Declaracao das variaveis
  11.     int opcao;
  12.     int a, b;
  13.     double potencia;
  14.  
  15.     // Logica
  16.     do {
  17.         printf("Digite o numero a\n");
  18.         scanf("%d", &a);
  19.  
  20.         printf("Digite o numero b\n");
  21.         scanf("%d", &b);
  22.  
  23.         // Exibe o resultado da potencia
  24.         potencia = pow(a, b);
  25.  
  26.         // Exibe o resultado
  27.         printf("%d^%d = %.0lf\n", a, b, potencia);
  28.  
  29.         printf("Digite\n* 1: Continuar\n* 2: Parar\n");
  30.         scanf("%d", &opcao);
  31.     } while(opcao == 1);
  32.  
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement