Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <conio.h>
- using namespace std;
- int main()
- {
- char operacja;
- int wynik, liczba1, liczba2;
- printf("Podaj liczbe 1 = ");scanf("%d",&liczba1);
- printf("Podaj liczba 2 = ");scanf("%d",&liczba2);
- printf("Podaj opercje do wykonania [+,-,*,\\]");//scanf("%c",&operacja);
- //operacja = getchar();
- operacja=getch();
- if (operacja == '+')
- wynik = liczba1 + liczba2;
- else
- if (operacja == '-')
- wynik = liczba1 - liczba2;
- else
- if (operacja =='*')
- wynik = liczba1 * liczba2;
- else
- wynik = liczba1 / liczba2;
- printf("\nWynik: %d%c%d=%d",liczba1,operacja,liczba2,wynik);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement