fork download
  1. #include <math.h>
  2. double shape(int i,double x)
  3. {
  4. double fun,h,L;
  5. int n;
  6. n=100;
  7. L=1.0;
  8. h=L/n;
  9. x=x-i*h;
  10. x=fabs(x);
  11. if(x<=h)
  12. fun=(1.0-x/h);
  13. else
  14. fun=0.0;
  15. return fun;
  16. }
  17.  
  18. int main()
  19. {
  20. int N=101;
  21. double O,F,h;
  22. h=0.001;
  23. for(int i=0;i<N;i++)
  24. {
  25. F=h*(i+1);
  26. O=shape(i,F);
  27. (void)O;
  28. }
  29. }
Success #stdin #stdout 0s 1828KB
stdin
Standard input is empty
stdout

Standard output is empty