ADVERTISEMENT
ADVERTISEMENT

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

Here, we are going to demonstrate the trigonometry angles in degrees using Math class in C#.
Submitted by Nidhi, on September 21, 2020

Here we will get the values of trigonometry angles for the specified degrees using Math class.

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.

C# Basic Programs »


ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.