Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- double t,l1,l2,sum=0,arx[100],ary[100],x;
- cout<<"Enter the number of iteration = ";
- cin>>t;
- cout<<"Enter upper limit = ";
- cin>>l2;
- cout<<"Enter lower limit = ";
- cin>>l1;
- x=(l2-l1)/t;
- arx[0]=l1;
- for(int i=1; i<=t; i++)
- {
- arx[i] = arx[i-1]+x;
- }
- for(int i=0; i<=t; i++)
- {
- ary[i] = sqrt((1-pow(arx[i],2)));
- }
- for(int i=1; i<t; i++)
- {
- sum = sum+2*ary[i];
- }
- sum = (sum+ary[0]+ary[5])*.5*x;
- cout<<"The summation is = "<<sum;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement