Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <stdio.h>
  2. main()
  3. {
  4. double n1, n2, s, su, m, d, o;
  5.  
  6. printf("Introduz o Primeiro Numero: ");
  7. scanf("%lf", &n1);
  8. printf("Introduz o Segundo Numero: ");
  9. scanf("%lf", &n2);
  10. printf("\nEscolha um Operacao: \n");+
  11. printf("\nDigite (1) Para Soma \n");
  12. printf("Digite (2) Para Subtracao\n");
  13. printf("Digite (3) Para Multiplicacao\n");
  14. printf("Digite (4) Para Divisao\n");
  15. printf("\n");
  16. scanf("%lf", &o);
  17.  
  18. if (o==1)
  19. {
  20. s=n1+n2;
  21. printf("Resultado: %lf", s);
  22.  
  23. } else {
  24.  
  25. if (o==2)
  26. {
  27. su=n1-n2;
  28. printf("Resultado: %lf", su);
  29.  
  30. } else {
  31.  
  32. if(o==3)
  33. {
  34. m=n1*n2;
  35. printf("Resultado: %lf", m);
  36.  
  37. } else {
  38.  
  39. if(o==4)
  40. {
  41. d=n1/n2;
  42. printf("Resultado: %lf", d);
  43.  
  44. } else {
  45.  
  46. printf("Nao Introduziu o numero correto");
  47. }
  48.  
  49. }
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement