Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- int a, b;
- char c;
- float x;
- printf ("Vvedite dva chisla\n");
- scanf ("%d %d", &a, &b);
- printf ("Vvedite deystvie: +, -, *, / or sqrt\n");
- scanf ("%s", &c);
- if (c=='+')
- {
- x=a+b;
- }
- if (c=='-')
- {
- x=a-b;
- }
- if (c=='*')
- {
- x=a*b;
- }
- if (c=='/')
- {
- if (b==0)
- {
- printf ("YOU DO IT WRONG\n");
- }
- else
- {
- x=a/b;
- }
- }
- printf ("%f", x);
- }
Add Comment
Please, Sign In to add comment