Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int a;
- int b;
- int e;
- int r;
- char c;
- int main(){
- printf("vvedite 1 chislo\n");
- scanf("%d", &a);
- printf("vvedite operachiyu\n");
- scanf("%s", &c);
- printf("vvedite 2 chislo\n");
- scanf("%d", &b);
- if (c =='+')
- r = 1;
- else if (c =='-')
- r = 2;
- else if (c =='*')
- r = 3;
- else if (c =='/')
- r = 4;
- switch (r){
- case 1 : summa(); break;
- case 2 : raznost(); break;
- case 3 : umnogenie(); break;
- case 4 : delenie(); break;
- }
- }
- void summa(){
- e = a+b;
- printf("otvet %d", e);
- }
- void raznost(){
- e = a-b;
- printf("otvet %d", e);
- }
- void umnogenie(){
- e = a*b;
- printf("otvet %d", e);
- }
- void delenie(){
- e = a/b;
- printf("otvet %d", e);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement