Q:

C# program to calculate the fractional power of numbers

belongs to collection: C# Basic Programs | basics

0

C# program to calculate the fractional power of numbers

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

The source code to calculate the fractional power of numbers is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.

//C# program to calculate the fractional power of numbers.

using System;

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

        number1 = Math.Pow(Math.PI  , 3.2);
        number2 = Math.Pow(1.67     , 1.8);
        number3 = Math.Pow(Math.E   , 1.7);
        
        Console.WriteLine("Number1 : "+ number1);
        Console.WriteLine("Number2 : "+ number2);
        Console.WriteLine("Number3 : "+ number3);
    } 
}

Output:

Number1 : 38.983389093418
Number2 : 2.51703728061624
Number3 : 5.4739473917272
Press any key to continue . . .

Explanation:

Here, we created a class FractionalPower that contains the Main() method, here we create three variables of the double type that are initialized with 0.

number1 = Math.Pow(Math.PI  , 3.2);
number2 = Math.Pow(1.67     , 1.8);
number3 = Math.Pow(Math.E   , 1.7);

In the above code, we calculated the fraction power of various numbers. Then we printed 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 bitwise operations... >>
<< C# program to print the edge values using Pow() me...