Question:

Pls help! draw a flow chrt that wil comput d speed of 10 cars when distance is in km,time in hr/min/sec?

by  |  earlier

0 LIKES UnLike

calculate the average speed of the cars in km/h and write a fortran program based on ur flow diagram.

 Tags:

   Report

2 ANSWERS


  1. With the time in hr:min:sec format, the first thing to do is convert the speed to hour and decimal of hours.

    Assuming the values defined in this manner:

         INTEGER tht,tmin,tsec

    and set up to current value, then the "time" in real will be defined in this manner, and computer like this:

        REAL xtime

        xtime=(FLOAT(tsec)/60.) + FLOAT(tmin))/60.+FLOAT(tht)

    If the time components (hour, minute and second) are already real, on could omit the FLOAT type conversion function.

    Then, you have to derive the speed:

        carspd(i)=dist/xtime

    where "dist" is the distance (is it the same for all 10 cars, or is the time different?  This does have an impact on the program structure).

    If we want a more general program, an integer variable "nbcar" can be defined and set to 10.

    Then the speed have to be accumulated, something like this:

        avgspd=carspd(1)/FLOAT(nbcar)

        DO i=2,nbcar

         avgspd=avgspd+carspd(i)/FLOAT(nbcar)

        ENDDO


  2. Hi,

    I don't know fortran but tis can be easily done in MS excel. Hope this is helpful.

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.