Untitled

 avatar
unknown
plain_text
4 years ago
620 B
11
Indexable
#include <stdio.h>
#include <stdlib.h>

int main()
{
    double timeB,timeA,avg;
    int length;
    //part(a)
    length=2;
    timeA=8+(5/60)+(10/60);//time in hours for tA
    timeB=8+(6/60)+(10/60);//time in hours for tB
    //calculation of the average speed
    avg= length/(timeB-timeA);
    printf("(a).The average is %f",avg);

    //part(b)
    int length1=10;
    double timeC=23+(24/60)+(5/60);//time in hours for tC
    double timeD=23+(30/60);//time in hours for tD
    //calculation of the average speed
    double avg1= length1/(timeD-timeC);
    printf("\n(b).The average is %f",avg1);


    return 0;
}
Editor is loading...