Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double f(int x)
- {
- return 3*x + 1;
- }
- double p(int x)
- {
- return 3;
- }
- int main()
- {
- int n;
- double a,b;
- cout<<"Podaj poczatek przedzialu: ";
- cin>>a;
- cout<<"Podaj koniec przedzialu: ";
- cin>>b;
- cout<<"Podaj ilosc iteracji: ";
- cin>>n;
- double x[n];
- for(int i = 1; i < n;i++)
- {
- x[i] = x[i-1] - f(x[i-1])/p(x[i-1]);
- }
- cout<<"Miejsce zerowe to ~ "<<x[n]<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement