Computer Science, asked by ayeshakkhan6865, 11 months ago

The driver took a drive to a town 240 km at a speed of 60 km /h .Later in the evening he drove back at 20 km / h less than the usual speed .Write a program to calculate- (i) the total time taken by the driver. (ii) the average speed during the whole

Answers

Answered by carmeldevj
8

Answer:

void main(){

int totalTime,avgSpeed;

int moringTotalTIme,evgTotalTime,totalKm = 240;

morningTotalTIme = 240/60;

evgTotalTime = 240/(60-20);

toalTime = morningTotalTIme +evgTotalTime ;

avgSpeed = (2*240)/totalTime;

printf("Totaltime taken by the driver: %d, ",toalTime );

printf("Average speed during the whole:%d/h",avgSpeed );

}

Explanation:

Answered by unknowngirl11
30

Answer:

Hey mate!!

Here's ur answer ..

class drive

{

public static void main (String args[ ])

{

int d ,s1,s2,tt,td,t1,t2;

Double avg;

d=240;

s1=60;

s2=60-20;

t1=d/s1;

t2=d/s2;

tt=t1+t2;

td=d*2;

avg = td/tt;

System.out.println(" Total time taken by driver =" +tt);

System.out.println ("Average speed ="+avg);

System.out.println ("Program ends");

}

}

HOPE IT HELPS!!!

Similar questions