0

I'm trying to make a program to work out sin cos and tan for my uncle. i'm pretty new to c#. i made you have to type in three text boxes and it would then take the information and divide it and output the answer into a label but it would keep on rounding it off please help. here is my code:

 int triA = Int32.Parse(enterA.Text);
        int triB = Int32.Parse(enterB.Text);
        int triHYP = Int32.Parse(enterHyp.Text);


        Double sinAns = triA / triHYP;
        Double cosAns = triB / triHYP;
        Double tanAns = triA / triB;



        sinAnswear.Text = sinAns.ToString();
        cosAnswear.Text = cosAns.ToString();
        tanAnswear.Text = tanAns.ToString();
k.p
  • 1
  • 1
    instead of `Int32.Parse` use `double.Parse`, because in `triA / triHYP` : `int / int` will return `int`, **not double** and so on – boop_the_snoot Oct 30 '17 at 05:52
  • triA / triHYP already truncates the decimal since both are integer type. try to Convert.ToDouble(triA)/triHYP – Joseph Wu Oct 30 '17 at 05:58

0 Answers0