pow function in C programming Language

In this tutorial, we will discuss pow function in C programming Language

Description

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

 

Declaration

The declaration for the pow()  in the C Programming language is

double pow(double x,double y );

Parameter or Argument

parameter of pow() function is:

x,y are the arguments of this function

 

Return

The pow() function returns x raised to the power of y

Required header

In this Language, The required header for the pow function is

#include <math.h>

Example

The following example shows the usage of pow()

pow function in C

program 1
#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

trunc() function in C langue

exp() function in C language

sqrt() function in C language       

cosh function   in C  language                               

sinh function in C language

tanh function in C language

abs function in C language

floor function in C language

ceil function in C language

round function in C language

 

suggested for you

Function in C language

User defined function in C language

Arithmetic functions in C Language

String function in C language

 

 

trunc function in C programming language
sqrt function in C programming language
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

C# inverted full pyramid star pattern

C# inverted full pyramid star pattern In this article, we will discuss the concept of…

3 weeks ago

C# Full Pyramid star pattern program

C# Full Pyramid star pattern program In this article, we will discuss the concept of…

1 month ago

Program to count vowels,consonants,words, characters and space in Java

Program to count vowels, consonants, words, characters and space in Java In this article, we…

1 month ago

How to print multiplication table using Array in C++ language

How to print multiplication table using Array in C++ language In this post, we will…

1 month ago

C Program to multiplication table using Array

C Program to multiplication table using Array In this tutorial , we will discuss about…

1 month ago

Java program to check odd or even using recursion

Java program to check odd or even using recursion In this tutorial, we discuss a…

1 month ago