Advertisement
Maszi

Untitled

Oct 13th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement