Advertisement
dzieciol

Labolatorium I zadanie 4

Oct 25th, 2015
471
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. {
  6.     int x,y;
  7.     float w;
  8.  
  9.     printf("Podaj wartość x\n");
  10.     scanf("%d",&x);
  11.     printf("Podaj wartość y\n");
  12.     scanf("%d",&y);
  13.     switch(x){
  14.         case 1:w=y;
  15.         break;
  16.         case 2:w=y*y*6;
  17.         break;
  18.         case 3:w=y+1;
  19.         w=sqrt(w);
  20.         break;
  21.         case 4:w=x-5;
  22.         if (w<0) w=w-2*w;
  23.         break;
  24.         case 5:w=y%5; break;
  25.         default: w=0;
  26.     }
  27.  
  28.  
  29.  
  30.     printf("%f",w);
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement