## Oct 12, 2011

### C program to find the distance traveled at regular intervals of time given .

C program to find the distance traveled at regular intervals of time given the values of 'u' and 'a'. The program should provide the flexibility to the user to select his own time intervals and repeat the calculations for different values of 'u' and 'a'. Read more about C Programming Language .

```/***********************************************************
* You can use all the programs on  www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact info@c-program-example.com
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
*                                  Happy Coding
***********************************************************/

#include <stdio.h>
#include <math.h>

void main() {
int tim_intrval, counter, time;
float accl, distance = 0, velos;
clrscr();
printf(
"<===========PROGRAM TO CALCULATE TOTAL DISTANCE TRAVELED BY A VECHIAL===========>");
printf("\n\n\n\tNO OF TIME INTERVALS : ");
scanf("%d", &tim_intrval);

for (counter = 1; counter <= tim_intrval; counter++) {
printf("\n\t\tAT T%d TIME(sec) : ", counter);
scanf("%d", &time);
printf("\t\tVELOCITY AT %d sec (m/sec) : ", time);
scanf("%f", &velos);
printf("\t\tACCLERATION AT %d sec (m/sec^2): ", time);
scanf("%f", &accl);
distance += (velos * time + (accl * pow(time, 2)) / 2);
}

printf(
"\n\n\n\tTOTAL DISTANCE TRAVELLED BY VEHICLE IN %d INTERVALS OF TIME : %f",
tim_intrval, distance);
getch();
}```
```Read more Similar C Programs
Learn C Programming

C Strings```
You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!