fork(1) download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6. double a = 2.5;
  7. double b = 0.4;
  8. double y;
  9.  
  10. double t_start = -1.0;
  11. double t_end = 1.0;
  12. int points = 50;
  13. printf("y\n");
  14. for (int i = 0; i < points; i++)
  15. {
  16. double t = t_start+((t_end-t_start)/(points))*i;
  17.  
  18. if (t<-0.1)
  19. {
  20. y = pow(a * t * t + b * sin(t) + 1, 0.5);
  21. }
  22.  
  23. else if (t >= -0.1 && t <= 0.5)
  24. {
  25. y = a * t + b;
  26. }
  27.  
  28. else
  29. {
  30. y = pow(a * t * t + b * cos(t) + 1, 0.5);
  31. }
  32.  
  33. printf("%f\n", y);
  34. }
  35.  
  36. return 0;
  37. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
y
1.778598
1.725202
1.672650
1.621020
1.570396
1.520874
1.472559
1.425569
1.380030
1.336085
1.293887
1.253605
1.215421
1.179529
1.146134
1.115452
1.087700
1.063096
1.041853
1.024167
1.010214
1.000136
0.994040
0.200000
0.300000
0.400000
0.500000
0.600000
0.700000
0.800000
0.900000
1.000000
1.100000
1.200000
1.300000
1.400000
1.500000
1.600000
1.422367
1.457018
1.493363
1.531286
1.570678
1.611435
1.653461
1.696668
1.740972
1.786298
1.832574
1.879736