#include <stdio.h>
#include <conio.h>
float raise_to_power(float num, int power)
{
float ans=1, i;
for(i=1; i<=power; i++)
{
ans=ans*num;
}
return ans;
}
main()
{
int power=0;
float num=0;
printf("Enter a number: ");
scanf("%f", &num);
printf("Enter Power: ");
scanf("%d", &power);
printf("Answer is: %f", raise_to_power(num, power));
getch();
}
#include <conio.h>
float raise_to_power(float num, int power)
{
float ans=1, i;
for(i=1; i<=power; i++)
{
ans=ans*num;
}
return ans;
}
main()
{
int power=0;
float num=0;
printf("Enter a number: ");
scanf("%f", &num);
printf("Enter Power: ");
scanf("%d", &power);
printf("Answer is: %f", raise_to_power(num, power));
getch();
}