Maszi

Untitled

Oct 13th, 2019
55
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. int main()
  6. {
  7.     float x, result;
  8.     printf("Podaj x \n");
  9.     scanf("%f", &x);
  10.     if(x<-1){
  11.         result = pow(x,2);
  12.         printf("%f", result);
  13.         } else if(x>1){
  14.         result = 1/x;
  15.         printf("%.2f", result);
  16.         } else {
  17.         result = 2*x;
  18.         printf("%.6f", result);
  19.         }
  20.     return 0;
  21. }
RAW Paste Data