Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- main(){
- float a, b, risult;
- printf("Inserisci il primo numero: ");
- scanf("%f", &a);
- printf("Inserisci il secondo numero: ");
- scanf("%f", &b);
- printf("Scegli l'operazione da svolgere: \n1-Somma \n2 - Sottrazione \n3 - Moltiplicazione \n4 - Divisione\n ");
- int s; //scelta
- scanf("%d", &s);
- switch(s)
- {
- case 1:
- {
- risult = a+b;
- break;
- }
- case 2:
- {
- risult = a-b;
- break;
- }
- case 3:
- {
- risult = a*b;
- break;
- }
- case 4:
- {
- risult = a/b;
- break;
- }
- }
- printf("%f", risult);
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement