ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

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

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

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

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.

ADVERTISEMENT




Comments and Discussions

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.