The total distance travelled by a vehicle in t seconds is given by
distance = ut + (at2)/2
Where u is the initial velocity (meters per second), a is the acceleration (metres per second 2).
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.
#include<stdio.h>
void main()
{
float u,t,a,distance;
printf("Enter the velocity, accelaration and time intervals\n\n");
scanf("%f %f %f",&u,&a,&t);
distance = u*t + (a*t*t)/2;
printf("Velocity = %5.2fm/s\nAccelaration = %5.2fm/sec2 \nTime interval = %5.2fsec\n",u,a,t);
printf("Distance = %8.2f",distance);
getch();
}
distance = ut + (at2)/2
Where u is the initial velocity (meters per second), a is the acceleration (metres per second 2).
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.
#include<stdio.h>
void main()
{
float u,t,a,distance;
printf("Enter the velocity, accelaration and time intervals\n\n");
scanf("%f %f %f",&u,&a,&t);
distance = u*t + (a*t*t)/2;
printf("Velocity = %5.2fm/s\nAccelaration = %5.2fm/sec2 \nTime interval = %5.2fsec\n",u,a,t);
printf("Distance = %8.2f",distance);
getch();
}
No comments:
Post a Comment