Sei sulla pagina 1di 2

program HW2

implicit none
integer::i
real::x(0:20),y(0:20),h,n
write(*,*)'Enter the value of h'
read(*,*)h
n=(1.0-x(0))/h
x(0)=0.0
x(n)=1.0
y(0)=1.0
do i=0,n
x(i)=i*h
y(i+1)=y(i)+h*((y(i)+x(i))**2)
end do
write(*,*)'

i','

do i=0,n
write(*,*)i,x(i),y(i)
end do
end

x(i)','

y(i)'

Enter the value of h


0.1
i

x(i)

y( i)

0.000000E+00

1.000000

1.000000E-01

1.100000

2.000000E-01

1.244000

3.000000E-01

1.452514

4.000000E-01

1.759644

5.000000E-01

2.226050

6.000000E-01

2.969185

7.000000E-01

4.243094

8.000000E-01

6.686512

9.000000E-01

12.291300

10

1.000000

29.692330

Potrebbero piacerti anche