Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- float F(float x) {
- return sin(x);
- }
- int main () {
- long double p, q, dl, s, pole;
- int n, i;
- cout<<"Podaj liczbe rzeczywista p: "<<endl;
- cin>>p;
- cout<<"Podaj liczbe rzeczywista q: "<<endl;
- cin>>q;
- cout<<"Podaj liczbe prostokatow (liczba naturalna) n: "<<endl;
- cin>>n;
- dl = (q-p) / n;
- s = 0;
- while(i<n) {
- s = s + fabs(F(p+dl*i + (dl/2)));
- i++;
- }
- pole = dl*s;
- cout<<"Pole wynosi: "<<pole<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment