Q:

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

belongs to collection: C# Basic Programs | basics

0

C# program to demonstrate the trigonometry angles in degrees 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 degrees is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.

//C# program to demonstrate the Trigonometry Angles 
//in degrees using Math class

using System;

class Demo
{
    static void Main(string[] args)
    {
        double sin60;
        double cos60;
        double tan60;

        sin60 = Math.Sin(60 * Math.PI / 180);
        cos60 = Math.Cos(60 * Math.PI / 180);
        tan60 = Math.Tan(60 * Math.PI / 180);

        Console.WriteLine("Sin (60)     = "+ sin60);
        Console.WriteLine("Cos (60)     = "+ cos60);
        Console.WriteLine("Tan (60)     = "+ tan60);
    }
}

Output:

Sin (60)     = 0.866025403784439
Cos (60)     = 0.5
Tan (60)     = 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.

sin60 = Math.Sin(60 * Math.PI / 180);
cos60 = Math.Cos(60 * Math.PI / 180);
tan60 = Math.Tan(60 * Math.PI / 180);

In the above code we calculated the trigonometry angles based on specified degrees 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 demonstrate the trigonometry angles ... >>
<< C# program to find the value of sin(x)...