Program to calculate Kinetic Energy and Potential Energy | Function to calculate Kinetic Energy ; Stores the Kinetic Energy ; Function to calculate Potential Energy ; Stores the Potential Energy ; Driver Code
function kineticEnergy ( M , V ) { let KineticEnergy ; KineticEnergy = 0.5 * M * V * V ; return KineticEnergy ; } function potentialEnergy ( M , H ) { let PotentialEnergy ; PotentialEnergy = M * 9.8 * H ; return PotentialEnergy ; } let M = 5.5 , H = 23.5 , V = 10.5 ; document . write ( " " + kineticEnergy ( M , V ) ) document . write ( " " ) ; document . write ( " " + potentialEnergy ( M , H ) )