C program to find power of two numbers using built in functions pow
/** C program to find power of two numbers using built in functions pow by codebind.com */ #include<stdio.h> #include<conio.h> #include<math.h> int main() { double number; number = pow(2.0, 4.0); printf("Value of 2^4 = %f", number); getch(); } /* OUTPUT Value of 2^4 = 16.000000 */
C program find power of number without using built in functions pow
/** C program to find power of two numbers without using built in functions pow by codebind.com */ #include<stdio.h> #include<conio.h> int Power(int c, int d) { int pow=1; int i=1; while(i<=d) { pow=pow*c; i++; } return pow; } int main() { int result,b,c; printf("Enter the number\n"); scanf("%d",&b); printf("Enter the power\n"); scanf("%d",&c); result= Power(b,c); printf("Value of %d^%d = %d",b,c,result); getch(); } /* OUTPUT Enter the number 5 Enter the power 2 Value of 5^2 = 25 */
Thanks for sharing this program. Very helpful for beginners.