Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
31 views2 pages

C Program: Calculate Mechanical Energy

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views2 pages

C Program: Calculate Mechanical Energy

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Program 1

C Program to find Mechanical Energy of a particle using E = mgh+1/2 mv 2.

Theory

Mechanical energy is generally defined as the sum of potential energy and kinetic energy in an object.
It is accumulated due to performing some particular work. In other words, we can describe the energy
of an object because of its motion or position, or sometimes both.

Mechanical Energy E = (m × g × h) + (0.5 x m x v x v) Joules


where,
m = mass of a particle in kg
g = acceleration due to gravity = 9.8 meters/sec2
h = height of a particle from the ground in meters
v = velocity of a particle in meters/sec

Algorithm

Begin

Define acceleration due to gravity, g = 9.8, as constant using const keyword.

1. Input values:
 Read the mass of a particle, m (in kg)
 Read the height above a reference point, h (in meters)
 Read the velocity of a particle, v (in meters per second)
2. Calculate total mechanical energy:
 Add the potential energy and kinetic energy:
e = (m × g × h) + (0.5 x m x v x v)
3. Output the result:
 Print the total mechanical energy e

End

Flowchart
C Program
#include<stdio.h>
const float G = 9.8;
int main()
{
float m, v, h, e;
printf("Enter the mass (in kg):");
scanf("%f”, &m);
printf("Enter the height (in metres):");
scanf("%f", &h);
printf("Enter the velocity (in meters per second):");
scanf("%f", &v);
e = (m*G*h)+(0.5*m*v*v);
printf("Mechanical Energy of a particle is %f Joules", e);
return 0;
}

You might also like