Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- // x^2 + y^2 = 1
- double y(double x)
- {
- return sqrt(1 - pow(x,2)) ;
- }
- int main(int argc, char *argv[])
- {
- double i,A=0 ;
- for(i=-1;i<0 ; i = i+0.1)
- {
- A += (y(i+0.1)-y(i)) * 0.1 ;
- }
- A = A * 4 ;
- printf("%.5f\n",A);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment