Find a Power b
Q. WAP to find a power b.
#include<stdio.h>
#include<conio.h>
int power(int a,int b);
void main()
{
int a,b,c;
clrscr();
printf("Enter the Number : ");
scanf("%d",&a);
printf("Enter the power of the number : ");
scanf("%d",&b);
c = power(a,b);
printf("Value of %d raise to power %d is : %d",a,b,c);
getch();
}
int power(int a,int b)
{
int c=1,i;
for (i=1;i>=b;i++)
{
c = c * a;
}
return c;
}