Write a program to print the third power of 2 using pow() fuction.assume the floating point numbers.

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
	double x=2.0,y=3.0;
	printf("%lf raised to %lf is %lf \n",x,y,pow(x,y));
	getch();
}

/*In the above program two variable x and y are declared and initialized.In the printf() statament
using pow() fuction expresion x^y is calculated and displayed.*/

The program starts by including the necessary header files stdio.h, conio.h, and math.h.

In the main() function, two double precision floating point variables x and y are declared and initialized to 2.0 and 3.0 respectively.

Then, the pow() function from the math.h library is called in the printf() statement to calculate the value of x raised to the power of y. The result is displayed on the console using the printf() statement.

Finally, the getch() function is used to pause the console output until the user presses a key.

The program essentially demonstrates the use of the pow() function to calculate powers of a given number. In this case, the third power of 2.0 is calculated using the pow() function and displayed on the console.

Thanks

Write a program to print the third power of 2 using pow() fuction.assume the floating point numbers.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top