Write a program that calculates the final velocity of an object by taking following inputs from the user: vi = initial velocity, a = acceleration, t = time span.
#include<iostream>
using namespace std;
float CalculateVelocity(float u, float acc, float t)
{
float v;
v=u+acc*t;
return v;
}
int main()
{
float vi,accl,time;
cout<<"Enter initial velocity : ";
cin>>vi;
cout<<"Enter acceleration : ";
cin>>accl;
cout<<"Enter time span : ";
cin>>time;
cout<<"Final velocity = "<<CalculateVelocity(vi,accl,time);
return 0;
}
Comments
Leave a comment