0

how to convert 44/5 in C# to get decimal values actual result will be like this 13.75 but i got only 13

need 13.75 how to get tried many solutions but not possible to get please help to find

-----------Tried Methods--------------------

protected void txtbox_TextChanged(object sender, EventArgs e)
{
    int cal= 55 / 4;  //13

    decimal cal= 55 / 4;  //13

    string cal= String.Format("{0:0.00}", 55 / 4);  //13.00

    decimal cal= decimal.Floor(55 / 4);     //13

    SalesPrice.Text = cal.ToString();
}
captainsac
  • 2,484
  • 3
  • 27
  • 48

2 Answers2

2

Try doing: decimal cal = 55m/4;

Buddy
  • 10,874
  • 5
  • 41
  • 58
0

Change it to :

decimal cal= (decimal)55 / 4;  //13.75
Rahul Nikate
  • 6,192
  • 5
  • 42
  • 54