Home »
.Net »
C# Programs
C# - Fractional Power of Numbers
Here, we are going to learn how to calculate the fractional power of numbers in C#?
By Nidhi Last updated : April 15, 2023
Here we will find the fractional power of numbers, and then print them on the console screen.
C# program to calculate the fractional power of numbers
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# - 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.
C# Basic Programs »