Calculate total distance traveled by a vehicle in t seconds is given by
DISTANCE = UT + (A * T * T)/2.
Where u is the initial velocity(meters per second), a is the accele-ration.Write a program to evaluate the distance travelled 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.
Code for Calculate total distance traveled by a vehicle in t seconds is given by DISTANCE = UT + (A * T * T)/2. in C Programming
#include<conio.h>
#include<stdio.h>
void main()
{
float u,a,dist;
int t;
clrscr();
printf(" Enter the value of a : ");
scanf("%f",&a);
printf(" Enter the year of u :- ");
scanf("%f",&u);
printf(" Enter the value of t :- ");
scanf("%d",&t);
dist = (u * t) + (a * t * t)/2;
printf("\n The distance equal to :- %f",dist);
getch();
}
/*
output
Enter the value of a : 4
Enter the year of u :- 5
Enter the value of t :- 6
The distance equal to :- 102.000000
*/