Advertisement
imedvedev

lab2

Oct 13th, 2013
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4. #include <windows.h>
  5.  
  6. int main()
  7. {
  8.     SetConsoleCP(1251);
  9.     SetConsoleOutputCP(1251);
  10.  
  11.     float x, y, newx, newy;
  12.  
  13.     printf("Введите X\n");
  14.     scanf("%f",&x);
  15.     printf("Введите Y\n");
  16.     scanf("%f",&y);
  17.  
  18.    
  19.     if(x > 0 && y > 0) {
  20.         newx = sqrtf(x);
  21.         newy = sqrtf(y);
  22.     } else if(x > 0 || y > 0) {
  23.         newx = pow(x, 2);
  24.         newy = pow(y, 2);
  25.     } else {
  26.         newx = fabsf(x);
  27.         newy = fabsf(y);
  28.     }
  29.  
  30.     printf("Результат:\n");
  31.     printf("X: %f\nY: %f", newx, newy);
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement