Program 1: Write a program in C to Find the distance traversed when initial velocity, acceleration, and time duration are given by the user.
#include <stdio.h>
int main() {
float initial_velocity, acceleration, time;
printf(“Enter initial velocity: “);
scanf(“%f”, &initial_velocity);
printf(“Enter acceleration: “);
scanf(“%f”, &acceleration);
printf(“Enter time: “);
scanf(“%f”, &time);
float distance = (initial_velocity * time) + (0.5 * acceleration * time * time);
printf(“Distance traveled: %f\n”, distance);
return 0;
}
Program 2: Write a program in C to Find the distance traversed when initial velocity, final velocity, and acceleration are given by the user.
#include <stdio.h>
int main() {
float initial_velocity, final_velocity, acceleration;
printf(“Enter initial velocity: “);
scanf(“%f”, &initial_velocity);
printf(“Enter final velocity: “);
scanf(“%f”, &final_velocity);
printf(“Enter acceleration: “);
scanf(“%f”, &acceleration);
float distance = ((final_velocity * final_velocity) – (initial_velocity * initial_velocity)) / (2 * acceleration);
printf(“Distance traveled: %f\n”, distance);
return 0;
}