fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main(void) {
  5. int x;
  6. float A;
  7. scanf("%d", &x);
  8. if(x>0)
  9. A=pow(x, 2);
  10. else
  11. if(x==0)
  12. A = x + 2;
  13. else
  14. A = x / 2;
  15. printf("A = %.1f.", A);
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 5292KB
stdin
-4
stdout
A = -2.0.