Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdio.h"
- #include "math.h"
- double f(double x, double y) {
- return y*y + 1;
- }
- int main() {
- // input data
- double y0 = 0.0, x0 = y0, f0 = f(x0, y0);
- // iteration data
- double x = x0, y = y0, h = 0.05;
- int i, a=0, b=1, n = (b-a)/h;
- // main loop
- for (i=0; i <= n + 1; ++i) {
- printf("y(%.03f) = %.05f\n", x, y);
- y = y + h*f(x, y);
- x += h;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement