C# | Math.Pow() Method - GeeksforGeeks

Skip to content geeksforgeeks
  • Courses
    • DSA Courses
    • Programming Languages
  • Tutorials
    • Python Tutorial
      • Python Loops and Control Flow
    • Java
      • Java Interview Questions
      • Java Quiz
      • Advance Java
    • Programming Languages
    • System Design
    • Interview Corner
    • Computer Science Subjects
    • DevOps
    • Linux
    • Software Testing
    • Databases
    • Android
    • Excel
    • Mathematics
  • DSA
    • Data Structures
    • Algorithms
      • Analysis of Algorithms
      • Searching Algorithms
      • Sorting Algorithms
    • Practice
      • Company Wise Coding Practice
      • Practice Problems Difficulty Wise
      • Language Wise Coding Practice
      • Curated DSA Lists
    • Company Wise SDE Sheets
    • DSA Cheat Sheets
    • Puzzles
  • Data Science
    • Data Science Packages
    • Data Visualization
    • Data Analysis
  • Web Tech
    • Web Development Using Python
      • Django
      • Flask
    • Cheat Sheets
  • .NET Framework
  • C# Data Types
  • C# Keywords
  • C# Decision Making
  • C# Methods
  • C# Delegates
  • C# Constructors
  • C# Arrays
  • C# ArrayList
  • C# String
  • C# Tuple
  • C# Indexers
  • C# Interface
  • C# Multithreading
  • C# Exception
Open In App C# | Math.Pow() Method Last Updated : 31 Jan, 2019 Summarize Comments Improve Suggest changes Like Article Like Save Share Report Follow

In C#, Math.Pow() is a Math class method. This method is used to calculate a number raise to the power of some other number.

Syntax:

public static double Pow(double base, double power)

Parameters:

double base: It is a double-precision floating-point number which is to be raised to a power and type of this parameter is System.Double.

double power: It is a double-precision floating-point number which specifies a power or exponent and type of this parameter is System.Double.

Return Type: The function returns the number base raised to the power. The type of this method is System.Double

Examples:

Input : base = 8, power =2 Output : 64 Input : base = 2.5, power =3 Output : 15.625

Program: To demonstrate the Math.Pow()

// C# program to illustrate the // Math.Pow() function using System; class GFG { // Main Method static public void Main() { // Find power using Math.Pow // 6 is base and 2 is power or // index or exponent of a number double pow_ab = Math.Pow(6, 2); // Print the result Console.WriteLine(pow_ab); // 3.5 is base and 3 is power or // index or exponent of a number double pow_tt = Math.Pow(3.5, 3); // Print the result Console.WriteLine(pow_tt); // 202 is base and 4 is power or // index or exponent of a number double pow_t = Math.Pow(202, 4); // Print the result Console.WriteLine(pow_t); } }

Output:

36 42.875 1664966416

Reference: https://msdn.microsoft.com/en-us/library/system.math.pow(v=vs.110).aspx

Comment More info Next Article C# | Math.Sqrt() Method author jit_t Follow Improve

Similar Reads

  • C# | Math.Pow() Method In C#, Math.Pow() is a Math class method. This method is used to calculate a number raise to the power of some other number. Syntax: public static double Pow(double base, double power) Parameters: double base: It is a double-precision floating-point number which is to be raised to a power and type o 2 min read
  • C# | Math.Sqrt() Method In C#, Math.Sqrt() is a Math class method which is used to calculate the square root of the specified number. Sqrt is a slower computation. It can be cached for a performance boost. Syntax: public static double Sqrt(double d) Parameter: d: Number whose square root is to be calculated and type of thi 3 min read
  • C# | Math.Exp() Method In C#, Exp() is a Math class method which is used to return the e raised to the specified power. Here e is a mathematical constant whose value is approximately 2.71828. Exp() is the inverse of Log(). Syntax: public static double Exp (double num); Parameter: num: It is the required number of type Sys 2 min read
  • C# | Math.Log() Method In C#, Math.Log() is a Math class method. It is used to return the logarithm of a specified number. This method can be overloaded by changing the number of the arguments passed. There are total 2 methods in the overload list of the Math.Log() method as follows: Math.Log(Double) Method Math.Log(Doubl 4 min read
  • C# | Math.Log10() Method In C#, Math.Log10() is a Math class method. It is used to return the base 10 logarithm of a specified number. Syntax: public static double Log10(double val) Parameter: val: It is the specified number whose logarithm to be calculated and its type is System.Double. Return Value: It returns the logarit 2 min read
  • C# | Math.BigMul() Method In C#, BigMul() is a method class method. This method is used to compute the full product of two 32-bit numbers.Syntax: public static long BigMul(int a, int b) Parameters: a: It is the first number to be multiplied and the type of this parameter is System.Int32. b: It is the Second number to be mult 1 min read
  • MathF.Pow() Method in C# with Examples In C#, MathF.Pow(Single, Single) is a MathF class method. This method is used to calculate a number raise to the power of some other number. Syntax: public static float Pow (float x, float y); Parameters: x: It is a single-precision floating-point number which is to be raised to a power and type of 2 min read
  • MathF.Exp() Method in C# with Examples In C#, Exp(Single) is a MathF class method which is used to return the e raised to the specified power. Here e is a mathematical constant whose value is approximately 2.71828. Syntax: public static float Exp (float x); Here, x is the required number of type System.Single which specifies a power. Ret 1 min read
  • MathF.Log() Method in C# with Examples In C#, MathF.Log() is a MathF class method. It is used to return the logarithm of a specified number. This method can be overloaded by changing the number of the arguments passed. There are total 2 methods in the overload list of the MathF.Log() method as follows: MathF.Log(Single) Method MathF.Log( 4 min read
  • C# | Math Class Fields with Examples In C#, the Math class provides the constants and the static methods for logarithmic, trigonometric, and other mathematical functions. Math class has two fields as follows: Math.E FieldMath.PI FieldMath.E Field This field represents the natural logarithmic base, specified by the constant, e. Syntax: 3 min read
  • Power of a Number in C In this article, we will learn how to write a C program to calculate the power of a number (xn). We may assume that x and n are small and overflow doesn't happen. C Program To Calculate the Power of a Number A simple solution to calculate the power would be to multiply x exactly n times. We can do t 2 min read
  • Factorial Program in C Write a C program to find the factorial of the given number. A factorial is the product of all the natural numbers less than or equal to the given number N. Examples Input: N = 5Output: 120Explanation: 5! = 5 × 4 × 3 × 2 × 1 = 120 Input: N = 0Output: 1Explanation: 0! = 1 by definition Different Ways 4 min read
  • cbrt() Function in C cbrt() function in C is a predefined function in the math.h library used to calculate the cube root of a given number. To use this function, we must include the <math.h> header file in our program. It returns the cube root of the number as a double and works with double data types. For other d 3 min read
  • C log() Function log() function in C programming is a mathematical function provided by the math.h header file and is used to calculate the natural logarithm (base(e)) of a given number passed as parameter. This function returns natural logarithm of x as double and works with double data types for other data types l 3 min read
  • C Program to Multiply two Floating Point Numbers Floating point numbers are a way to represent real numbers with both whole parts and fractional parts. In this article, we will learn how to write a C program to find the product of two floating-point numbers. The below image shows an example of floating point multiplication in C: C Program To Multi 1 min read
  • C program to Count the digits of a number Given a number N, write a C program to find the count of digits in the number N. Examples: Input: N = 12345 Output: 5 Explanation: The count of digit in 12345 = 5 Input: N = 23451452 Output: 8 Explanation: The count of digits in 23451452 = 8Methods to Count Digits of a NumberThere are a few methods 4 min read
  • ilogb() Function in C The ilogb() function in C is a part of the standard math library <math.h>. It is used to compute the binary exponent of a floating-point number, which is the exponent of the value when represented as a normalized floating-point number. This function is particularly useful for numerical analysi 3 min read
  • C Program For Octal to Decimal Conversion The number system is one of the ways to represent numbers. Every number system has its own base or radix. For example, Binary, Octal, Decimal, and Hexadecimal Number systems are some of the number systems and are also used in microprocessor programming. These numbers are easy to convert from one sys 3 min read
  • Convert Binary to Decimal in C In this article, we will learn how to write a C program to convert the given binary number into an equivalent decimal number. Binary numbers are expressed in base 2 ( 0, 1 ) and decimal numbers are expressed in base 10 ( 0-9 ). Algorithm to Convert Binary Numbers to DecimalThe idea is to extract the 2 min read
  • Convert Decimal to Binary in C In this article, we will learn to write a C program to convert a decimal number into a binary number. The decimal number system uses ten digits from 0 to 9 to represent numbers and the binary number system is a base-2 number system that uses only 0 and 1 to represent numbers. Algorithm to Convert De 2 min read
Article Tags :
  • C#
  • CSharp-Math
  • CSharp-method
Like three90RightbarBannerImg Explore More We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy Got It ! Lightbox Improvement Suggest changes Suggest Changes Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal. geeksforgeeks-suggest-icon Create Improvement Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all. geeksforgeeks-improvement-icon Suggest Changes min 4 words, max CharLimit:2000

What kind of Experience do you want to share?

Interview Experiences Admission Experiences Career Journeys Work Experiences Campus Experiences Competitive Exam Experiences

Từ khóa » C# 2 Hoch N