answersLogoWhite

0

#include <stdio.h>

#include <math.h>

void main()

{

int tim_intrval, counter,time;

float accl, distance=0, velos;

clrscr();

printf("PROGRAM FOR CALC TOTAL DISTANCE TRAVELED BY A VECHIAL");

printf("\nNO OF TIME INTERVALS : ");

scanf("%d",&tim_intrval);

for(counter = 1; counter <= tim_intrval; counter++)

{

printf("\nAT T%d TIME(sec) : ",counter);

scanf("%d",&time);

printf("\tVELOCITY AT %d sec (m/sec) : ",time);

scanf("%f",&velos);

printf("\tACCLERATION AT %d sec (m/sec^2): ",time);

scanf("%f",&accl);

distance += (velos*time + (accl*pow(time,2))/2);

}

printf("\nTOTAL DISTANCE TRAVELLED BY VEHICLE IN %d INTERVALS OF TIME : %f",tim_intrval,distance);

getch();

}

User Avatar

Wiki User

12y ago

What else can I help you with?