G
G
gleb_oj2020-07-03 21:38:12
C++ / C#
gleb_oj, 2020-07-03 21:38:12

Incorrect output of cosine, what's wrong?

using System;

namespace ConsoleApp24
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("введите начальную скорость");
            int vstart = Convert.ToInt32(Console.ReadLine());
            int g = 10;
            Console.WriteLine("введите угол");
            double ugol = Convert.ToDouble(Console.ReadLine());
            double vvert = vstart * Math.Sin(ugol);
            double vgor = vstart * Math.Cos(ugol); // тут почему - то неправильно косинус выводит
            double t = vvert * 2 / g;
            double S = vgor * t;
            Console.WriteLine(S);
            Console.WriteLine(t);


        }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
milssky, 2020-07-03
@gleb_oj

https://docs.microsoft.com/en-us/dotnet/api/system...
The angle must be converted to radians.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question