Write a C program to find power of any number x ^ y - Basic C Program



Write a C program to find power of any number x ^ y


Objective:

Write a C program to input two numbers from user and find their power using pow() function. How to find power of a number in C programming. How to use pow() function in C programming.


Example


Input
Enter base: 5
Enter exponent: 2
Output

5 ^ 2 = 25



Solution:

// C program to find power of any number by CodexRitik #include <stdio.h> #include <math.h> // Used for mathematical function int main() { double base, expo, power; /* Input two numbers from user */ printf("Enter base: "); scanf("%lf", &base); printf("Enter exponent: "); scanf("%lf", &expo); /* Calculates base^expo */ power = pow(base, expo);//pow function using printf("%.2lf ^ %.2lf = %.2lf", base, expo, power); return 0; }



Note:

This Code is Verified by CodexRitik.If any error occurs then Comment correct code Below in comment box.

Disclaimer:-

The above hole problem solution is generated by the CodexRitik . if any of the query regarding this post or website fill the following contact form Thank You.

Write a C program to find power of any number x ^ y - Basic C Program Write a C program to find power of any number x ^ y - Basic C Program Reviewed by CodexRitik on January 11, 2021 Rating: 5

No comments:

Powered by Blogger.