Kaung Htet Kyaw

Kaung Htet Kyaw

  • NA
  • 66
  • 6.4k

How to solve the wrong result getting 0 value

Feb 4 2020 6:48 AM
Hi everyone,
               I want to ask that how to solve that problem. I have wrote the program about Calculating the Kinetic Energy. When I finished the program and calculate, it results Zero value. Whatever I change and checking my code,I  always get zero. Please someone fix my problem and I will appreciate any answers of my problem.
 
private void btnCalculator_Click(object sender, EventArgs e)
{
try
{
decimal m, v, K1,KE;
m = Convert.ToDecimal(txtm1.Text);
v = Convert.ToDecimal(txtv1.Text);
K1 = (1 / 2) * m * (v * v);
KE = K1;
lblKineticEnergy.Text = Convert.ToDecimal(KE) + " J";
}
catch (Exception)
{
MessageBox.Show("Please Enter Numbers Only", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
 
 

Answers (4)