# Find the Final Velocity of a Body Using Linear Motion Equation in C++

In this tutorial, we will learn how to calculate the final velocity of a body in C++ using linear motion. We take initial velocity, acceleration and time as parameters.

## The formula we are going to use to find the velocity of a body in C++ Using linear motion

Formula used :

v = u + a*t

where v: final velocity in m/s,

u: initial velocity in m/s,

a: acceleration in m/s^2.

t: time in seconds

This is the Linear motion equation. It is given by Newton.

Step 1: Define variables, make them the float data type. Here, we use four variables: v to define output and u, a and t to define parameters.

Step 2: Take values from the user.

Step 3: Calculate the answer using the formula and print it.

```#include <iostream>
using namespace std;

int main() {

float v,u,a,t ;
cout<<"Enter initial velocity \n" ;
cin>> u ;
cout<<"Enter acceleration \n" ;
cin>> a ;
cout<<"Enter time \n";
cin>> t ;
v = u + a*t ;
cout<<v ; ;

return 0;
}```

If we take u as 1.2, a as 2.2 and t as 3.2. The output will be:

```Enter initial velocity
Enter acceleration
Enter time
8.24```

Therefore, we calculated the final velocity of a body using Newton’s equation of first law in C++ by this simple code.