Q:

C# program to demonstrate the trigonometry angles in radians using Math class

belongs to collection: C# Basic Programs | basics

0

C# program to demonstrate the trigonometry angles in radians using Math class

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

The source code to demonstrate the trigonometry angles in radians is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.

//C# program to demonstrate the trigonometry Angles 
//in radians using Math class

using System;

class Demo
{
    static void Main(string[] args)
    {
        double sinPi3;
        double cosPi3;
        double tanPi3;

        sinPi3 = Math.Sin(Math.PI / 3);
        cosPi3 = Math.Cos(Math.PI / 3);
        tanPi3 = Math.Tan(Math.PI / 3);


        Console.WriteLine("sin (pi/3)    = "+ sinPi3);
        Console.WriteLine("cos (pi/3)    = "+ cosPi3);
        Console.WriteLine("tan (pi/3)    = "+ tanPi3);
    }
}

Output:

sin (pi/3)    = 0.866025403784439
cos (pi/3)    = 0.5
tan (pi/3)    = 1.73205080756888
Press any key to continue . . .

Explanation:

Here, we created a Demo class that contains the Main() method. In the Main() method, we created three variables of double type.

sinPi3 = Math.Sin(Math.PI / 3);
cosPi3 = Math.Cos(Math.PI / 3);
tanPi3 = Math.Tan(Math.PI / 3);

In the above code we calculated the trigonometry angles based radians using predefined method of Math class, and then print the result on the console screen.

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C# Basic Programs | basics

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C# program to calculate the MEAN of a set of given... >>
<< C# program to demonstrate the trigonometry angles ...