Power Function


  • The Power function is used for raising the given variable or constant (base) to some power .
  • The power to be raised can be given in various datatypes such as int , float , double ,long double .

  • Syntax:

    float powf(float base, float exp);
    
    double pow(double base, double exp);
    
    long double powl(long double base, long double exp); 

    Example:

    #include <math.h>
    #include <stdio.h>
    
      int main()
    	{ 
    		int a=4,b=2;
    		double x = 3.0, y = 2.0;
    
    		printf("%f\n", pow(a, b));
    		printf("%f\n", pow(x, y));
    
    		return 0;
    	}
    
    Back