#include <stdio.h>
int main()
{
// 7. Write a C program to find out distance travelled by the equation d = vt + at^2
printf("\t\tDistance Calculation");
printf("\n=======================================================");
float d, v, t, a;
printf("\n\n Enter The Velocity (m/s) : ");
scanf("%f", &v);
printf("\n Enter The Time periode (s) : ");
scanf("%f", &t);
printf("\n Enter The Acceleration (m/(s^2)): ");
scanf("%f", &a);
d = (v * t) + (a * t * t);
printf("\n_______________________________________________________");
printf("\n\n Distance Travelled By The Object Is : %.2f Meters", d);
printf("\n\n Formula Used d = vt + at^2");
printf("\n_______________________________________________________\n\n");
return 0;
}
printf
statements. It then takes the user inputs using the scanf
function.d
.printf
statements and returns 0 to indicate successful completion of the program.