#include <stdio.h>
#include <math.h>
int main ()
{
// declare base and exp variable
int base, exp;
int result; // store the result
printf (" Enter the base value from the user: ");
scanf (" %d", &base); // get base from user
printf (" Enter the power value for raising the power of base: ");
scanf (" %d", &exp); // get exponent from user
// use pow() function to pass the base and the exp value as arguments
result = pow ( base, exp);
printf (" %d to the power of %d is = %d ", base, exp, result);
return 0;
}
/**
* C program to find power of any number
*/
#include <stdio.h>
#include <math.h> // Used for pow() 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);
printf("%.2lf ^ %.2lf = %.2lf", base, expo, power);
return 0;
}
Code Example |
---|
C :: add border to image android |
C :: printf fill with 0 |
C :: bash convert find to array |
C :: is 33 prime number |
C :: is it possible to access argv in function |
C :: populate a map c++ |
C :: printf c float |
C :: multiplication of two matrix in c |
C :: get current used proxy windows 7 |
C :: silicon valley |
C :: c bit access union |
C :: what is covert channel |
C :: c argv |
C :: arduino millis |
C :: c print char |
C :: how to modulo in c without use the operator |
C :: how to print sizes of various data types of C |
C :: array reference argument |
C :: format specifiers in c |
C :: hello word in c |
C :: c check first character of string |
C :: selection sort algorithm in c |
C :: DrawText() raylib |
C :: how to allocate memory for pointer in c |
C :: c print |
C :: iterate through enum in qt |
C :: c assignment operators |
C :: gitlab ci heroku |
C :: fifo in c |
C :: Example of read and write project in c |