Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* program p1.c */
- # include <stdio.h>
- main()
- {
- int a,b;
- double x;
- char op;
- printf("podaj a:\n");
- scanf("%d",&a);
- printf("podaj b:\n");
- scanf("%d",&b);
- printf("podaj op:\n");
- fflush(stdin);
- scanf("%c",&op);
- switch(op)
- {
- case '+':x=a+b;
- break;
- case '-':x=a-b;
- break;
- case '/':x=a/b;
- break;
- case '*':x=a*b;
- break;
- case '%':x=a%b;
- break;
- default:printf("bledny operator. Koniec programu.\n");
- }
- printf("\n%d %c %d = %g\n",a,op,b,x);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement