Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #define eps 0.000001
- double f(double x)
- {
- return x + pow(x,2);
- }
- int main()
- {
- double x = 1.5;
- int cnt = 0;
- for(;fabs(x) <= 2.0 + eps; x+=0.05)
- {
- printf("f(%.2lf) = %.4lf\n",x,f(x));
- if(f(x) > 1.0)
- {
- cnt++;
- }
- }
- printf("cnt = %d\n",cnt);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement