Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main(){
- int optiune = 0;
- int x,y;
- float z;
- while (optiune!=-1)
- {
- printf("0. introducere numere\n");
- printf("1. suma\n");
- printf("2. diferenta\n");
- printf("3. produs\n");
- printf("4. medie\n");
- printf("-1. Renunta\n");
- fflush(stdout);
- scanf("%d", &optiune);
- switch (optiune)
- {
- case -1: break;
- case 0: printf("Dati cele doua numere:");
- fflush(stdout);
- scanf("%d%d",&x,&y);
- break;
- case 1: z = x + y; break;
- case 2: z = x - y; break;
- case 3: z = x * y; break;
- case 4: z = (float)(x + y)/2; break;
- default: {
- printf("\nTry again!!!");
- }
- }
- if(optiune > 0)
- printf("Rezultatul este: %g\n",z);
- }
- printf("S-a tastat -1!!!");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement