C# - Edge Values Using Pow() Method

Here, we are going to learn how to print the edge values using Pow() method in C#? By Nidhi Last updated : April 15, 2023

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

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

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.

C# Basic Programs »


Related Programs



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.