Guest User

Untitled

a guest
Dec 12th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6.     int a, b;
  7.     char c;
  8.     float x;
  9.     printf ("Vvedite dva chisla\n");
  10.     scanf ("%d %d", &a, &b);
  11.     printf ("Vvedite deystvie: +, -, *, / or sqrt\n");
  12.     scanf ("%s", &c);
  13.     if (c=='+')
  14.     {
  15.         x=a+b;
  16.     }
  17.     if (c=='-')
  18.     {
  19.         x=a-b;
  20.     }
  21.     if (c=='*')
  22.     {
  23.         x=a*b;
  24.     }
  25.     if (c=='/')
  26.     {
  27.         if (b==0)
  28.         {
  29.             printf ("YOU DO IT WRONG\n");
  30.         }
  31.         else
  32.         {
  33.             x=a/b;
  34.         }
  35.     }
  36.     printf ("%f", x);
  37. }
Add Comment
Please, Sign In to add comment