Write a program to find out power of a number

Write a program to find out power of a number


// Write a program to find out power of number.            
// Ex: base: 4 power: 2 -> 16, base: 3.2, power: 2.5 -> 18.32

 
#include
#include
int main(){
    float base,power;
    printf("Enter a base number:");              // input from user
    scanf("%f",&base);
    printf("Enter power:");
    scanf("%f",&power);
    
    printf("%.1f raised to power of %.1f is %0.2f\n",a,b,pow(base,power));  // using 'pow' predefined function
    getch();
}

No comments:

Post a Comment