Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3.  
  4. int main (void)
  5. {
  6.  
  7. float n1, n2;
  8. char op;
  9.  
  10. printf("Entre com numero:");
  11. scanf("%f", & n1);
  12.  
  13. printf("Entre com numero:");
  14. scanf("%f", & n2);
  15.  
  16. getchar();
  17. printf("Entre com a operacao: ");
  18. scanf("%c", &op);
  19.  
  20. if (op=='+')
  21. printf("Resultado: %.2f %c %.2f = %.2f", n1, op, n2, (n1+n2));
  22.  
  23. if (op=='-')
  24. printf("Resultado: %.2f %c %.2f = %.2f", n1, op, n2, (n1-n2));
  25.  
  26. if (op=='*')
  27. printf("Resultado: %.2f %c %.2f = %.2f", n1, op, n2, (n1*n2));
  28.  
  29. if (op=='/')
  30. printf("Resultado: %.2f %c %.2f = %.2f", n1, op, n2, (n1/n2));
  31.  
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement