Program to find the Magnitude of a Vector

Program to find the Magnitude of a VectorGiven three integers representing the X, Y, and Z coordinates of a 3-D vector, the task is to find the magnitude of that vector.Example:Input: X = 1, Y = 2, Z = 2Output: 3Explanation: Magnitude of the vector is equal to √9 =3Input: X = 0, Y = 4, Z = 3Output: 5Approach: The magnitude of a vector can be calculated by solving the equation √(X2 + Y2 + Z2). Follow the steps below to solve the problem:Stores the sum of the squares of the X, Y and Z coordinates in a variable, say sum.Initialize a variable, say magnitude, to store the square root of sum.Print the value of magnitude as the required result.Below is the implementation of the above approach:C++14#include using namespace std;  float vectorMagnitude(int x, int y, int z){              int sum = x * x + y * y + z * z;              return sqrt(sum);}  int main(){    int x = 1;    int y = 2;    int z = 3;        cout