Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <float.h>
  3. #include <math.h>
  4. #include <stdlib.h>
  5.  
  6.  
  7.  
  8.  
  9. int main ()
  10. {
  11.     float i, k, z;
  12.     float a,b;
  13.     float s;
  14.     int n;
  15.     s=0;
  16.     a=0;
  17.     b=2;
  18.     i=0;
  19.     n=100000;
  20.    
  21.    
  22.     for (;i<2;)
  23.     {
  24.       k=(i+i+0.00002)/2;
  25.    
  26.       z=powf(k,3);
  27.      
  28.       s=s+z;
  29.      
  30.       i=i+0.00002;
  31.      
  32.     }
  33.     s=((b-a)/n)*s;
  34.   printf ("%.16f\n",s);
  35.  
  36.  
  37.  getchar ();
  38.   return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement