Advertisement
dzieciol

Labolatorium II zadanie 6

Oct 25th, 2015
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {int x,y,m;
  6. float z;
  7.     printf("Podaj dwie liczby \n");
  8.     scanf("%d %d",&x,&y);
  9.  
  10.     printf("co chcesz zrobić? \n 1-dodawanie \n 2- odejmowanie \n 3- mnozenie \n 4- dzielenie \n") ;
  11.     scanf("%d",&m);
  12.     printf("\n");
  13.     switch(m){
  14.     case 1:z=x+y; break;
  15.     case 2:z=x-y; break;
  16.     case 3:z=x*y; break;
  17.     default:if (y!=0) z=x/y;else printf("dzielnik wynosi zero"); break;
  18.  
  19.  
  20.     }
  21.  
  22.         printf("wynik wynosi %f",z);
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement