Write
a program in C to input two variables from the user and calculate the power by
using library function.
Before going to program we should know about what is
library functions. Library function are those type of function which are provided
by the library of compiler itself.
For this program we are going to use pow function. This
function is used to calculate the power of the given number. This function
works upon two argument or parameters and after performing the operation always
return inter type value. The required header file for these functions is “math.h”.
Syntax: -
Int.
variable name = pow ( argument 1, argument 2);
Program: -
#include<stdio.h>
#include<math.h>
void main ( )
{
Int a, b, c;
clrscr ();
printf (“\n enter the first number=”);
scanf(“%d”, &a);
printf(“\n enter the power value=”);
scanf (“%d”, &b);
c= pow (a, b);
printf (“\n the required ans is =%d”,c);
getch();
}
OUTPUT: -
Enter the first number =
Enter the power value =
The required ans is=
Comments
Post a Comment