C# program to print the edge values using Pow() method

Here, we are going to learn how to print the edge values using Pow() method in C#?
Submitted by Nidhi, on October 03, 2020

Here, we will find edge values using the Pow() method of Math class and then print them on the console screen.

Program:

The source code to print the edge values using Pow() method is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.

//C# program to check the edge values in Pow() method. 

using System;

class Edge
{
    static void Main()
    {
        double number1 = 0;
        double number2 = 0;
        double number3 = 0;
        double number4 = 0;

        number1 = Math.Pow(double.PositiveInfinity, 2);
        number2 = Math.Pow(double.NegativeInfinity, 2);
        number3 = Math.Pow(double.MinValue, 0);
        number4 = Math.Pow(double.NaN, 2);
        
        Console.WriteLine("Number1 : {0}", number1);
        Console.WriteLine("Number2 : {0}", number2);
        Console.WriteLine("Number3 : {0}", number3);
        Console.WriteLine("Number4 : {0}", number4);
    }
}

Output:

Number1 : Infinity
Number2 : Infinity
Number3 : 1
Number4 : NaN
Press any key to continue . . .

Explanation:

Here, we created a class Edge that contains the Main() method. The Main() method is the entry point for the program. Here we declared 4 variables of the double type that are initialized with 0 and then find the edge's values of numbers using Pow() method of Math class and print the result on the console screen.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





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.