Advertisement
campos20

Untitled

May 10th, 2020
907
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 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
  11.     int a, b, opcao;
  12.     double resultado;
  13.  
  14.     // Repeticao
  15.     do {
  16.         printf("Digite o numero a\n");
  17.         scanf("%d", &a);
  18.  
  19.         printf("Digite o numero b\n");
  20.         scanf("%d", &b);
  21.  
  22.         // Calculo a^b
  23.         resultado = pow(a, b);
  24.  
  25.         printf("%d^%d = %lf\n", a, b, resultado);
  26.  
  27.         printf("Digite:\n");
  28.         printf("*1: Continuar\n");
  29.         printf("*2: Parar\n");
  30.  
  31.         scanf("%d", &opcao);
  32.     } while (opcao == 1);
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement