Given three integers M ,V and R representing the mass (in Kg) , velocity (in m/s) and radius of circular path (in meter) respectively. Our task is to calculate the centripetal force acting on the object of mass M kg.
Examples 1 :
Input : M=50 , V=20, R=50
Output : Centripetal Force= 400
Examples 2 :
Input : M=15 , V=10, R=20
Output : Centripetal Force= 75
Approach :
The Centripetal Force is defined as the product of mass (in kg) and tangential velocity (in meters per second) squared, divided by the radius (in meters). So we can calculate centripetal force using formula given below.
F=mv2/r
Implementation :
// C++ Program to implement
// the above approach
#include <bits/stdc++.h>
using namespace std;
// Function to calculate Centripetal Force
float centripetal_Force(float M, float V,float R)
{
// Stores the Centripetal Force
float centripetal_Force;
centripetal_Force=M*(V*V)/R;
return centripetal_Force;
}
// Driver Code
int main()
{
float M=50,V=20,R=50;
cout << "Centripetal Force = "
<< centripetal_Force(M,V,R) << endl;
return 0;
}
Output : Centripetal Force = 400
Time Complexity : O(1)
Auxiliary Space : O(1)