DarthVictor

Untitled

Oct 16th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.         char op;
  7.         float n1, n2;
  8.         printf("entre com a operacao(+ - / *) ");
  9.         scanf("%c",&op);
  10.         printf("entre com o numero 1 : ");
  11.         scanf("%f",&n1);
  12.         printf("entre com o numero 2 : ");
  13.         scanf("%f",&n2);
  14.         float res;
  15.  
  16.         if(op=='+'){res=n1+n2;}
  17.         else if(op=='-'){res=n1-n2;}
  18.         else if(op=='/'){res=n1/n2;}
  19.         else if(op=='*'){res=n1*n2;}
  20.  
  21.         printf("\nResultado : %f \n",res);
  22.         return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment