Pipe system program

I would appreciate some help in a program that calculates any parameter in a pipe system of n pipes in series, given the other parameters. For instance, calculate diameter of eaxh pipe knowing q,roughness, L, H, . I need a simple language program like Fortran or pascal