Hello Everyone
I have written a Fortran 90 program to solve the single equation of ODE (Ordinary differential equation) by the Huen method. But I need a hint for a system of n ODE in the program.
The program that I have for a single equation is as bellow. Any one can help me fo a system of n ordinary differential equation.

program huen
implicit none
real::x,y,k1,k2,f,x0,xn,y0,h
integer::n,i
open(unit=7, file='data.txt')
open(unit=8, file='Output.txt')
write(*,*)'The value of y with their corresponding x are:'
write(8,*)'The value of y with their corresponding x are:'
read(7,*)x0,y0,h,xn
n=(xn-x0)/h
x=x0
y=y0
do i=1,n
k1=f(x,y)
k2=f(x+h,y+k1*h)
y=y+(1/2.0)*h*(k1+k2)
x=x+h
write(*,'(f7.1,f7.4)')x,y
write(8,'(f7.1,f7.4)')x,y
end do
end program
function f(x,y)
real::x,y,f
f=y-x
end function

Welcome to the Fortran discourse forum! Is this an exercise? Because as @alozada indicates, there are several ready-made packages around for that sort of things and Heun’s method (correcting your typo as I type ;)) is definitely not the best around (although as always, it may depend on what you want to do).

Yes, it is an exercise. The function that I have used is some example, not specific. My problem is How I can modify this code for the n-system of ODE ( more than one equation)?

Another hint: do not confuse the variable ‘n’ that you already have in your code (where it represents the number of steps in x) with the variable that will represent the order of the system of ODEs (call the latter ‘m’ or something else other than ‘n’)

The n in that line is the number of steps of size h. In a later post, you asked “How I can modify this code for the n-system of ODE ( more than one equation)?” This n is quite different.

@Worku1 thanks for the question and welcome to the Forum! If this is a homework that your school gave you, then please mark it with the “Homework” tag. The best way to learn is to try implementing what others have suggested here, simply do your best, implement it in the code, search the internet or this forum how to do individual things, and then when you get stuck, post the code that you have and ask a specific question, and others will help you.