Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- main()
- {
- int a,b;
- double wynik;
- char znak;
- {
- printf(" Podaj a\n");
- scanf("%d",&a);
- printf("podaj b\n");
- scanf("%d",&b);
- fflush(stdin);
- printf("podaj znak dzialania ktore chcesz wykonac ( +, -, * ,/ \n)");
- znak=getchar();
- if ((znak!='+')|(znak!='-')|(znak!='*')|(znak!='/'))
- printf("noob\n");
- else
- printf("Kox\n");
- switch(znak)
- {
- case '+':
- wynik=a+b;
- break;
- case '-':
- wynik=a-b;
- break;
- case '*':
- wynik=a*b;
- break;
- case '/':
- wynik=a/b;
- break;
- }
- printf("\n %d %c %d = %g",a,znak,b,wynik);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement