C# program to calculate the fractional power of numbers

Here, we are going to learn how to calculate the fractional power of numbers in C#?
Submitted by Nidhi, on October 03, 2020

Here we will find the fractional power of numbers, and then print them on the console screen.

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.






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.