In this tutorial, we will discuss pow function in C programming Language
Pow() in C is used to find the power of the given number
The pow() function in C programming language (C library function) returns x raised to the power of y
pow(): In the C Programming Language, The pow() Arithmetic function calculate x raised to the power of y
The declaration for the pow() in the C Programming language is
double pow(double x,double y );
parameter of pow() function is:
x,y are the arguments of this function
The pow() function returns x raised to the power of y
In this Language, The required header for the pow function is
#include <math.h>
The following example shows the usage of pow()
#include <stdio.h> #include <math.h> int main() { printf("The Power value of pow(2,3) is %f\n",pow(2,3)); printf("The Power value of pow(3,4) is %f\n",pow(3,4)); getch(); return 0; }
When the above program is compiled, it will produce the following result
The power value of pow(2,3) is 8.000000
The power value of pow(3,4) is 81.000000
Example 2
#include <stdio.h> #include <math.h> int main() { //define temporary variable double val1,val2; double result; printf("Enter the number one :"); //get first input from user scanf("%lf",&val1); printf("Enter the number two :"); //get second input from user scanf("%lf",&val2); //calculate power result=pow(val1,val2); //Display power value printf("power value is: %lf\n",result); getch(); return 0; }
When above program is compiled, it will produce the following result
Enter te number one :5 Enter te number two :6 Power value is :15625.000000
Suggested for you
suggested for you
User defined function in C language
Arithmetic functions in C Language
C# inverted full pyramid star pattern In this article, we will discuss the concept of…
C# Full Pyramid star pattern program In this article, we will discuss the concept of…
Program to count vowels, consonants, words, characters and space in Java In this article, we…
How to print multiplication table using Array in C++ language In this post, we will…
C Program to multiplication table using Array In this tutorial , we will discuss about…
Java program to check odd or even using recursion In this tutorial, we discuss a…