#include<stdio.h>
main()
{
int power (a,b);
int a, b, result;
printf("Enter the value of a and b:");
scanf ("%d %d", &a, &b);
result=power(a,b);
printf("%d raised to %d is %d", a, b, result);
}
power (int a, int b)
{
int calculation=1, calc;
for (calc=1; calc <=b; calc++)
{
calculation=calculation*a;
continue;
}
return(calculation);
}
The File can be found at:
Download File
main()
{
int power (a,b);
int a, b, result;
printf("Enter the value of a and b:");
scanf ("%d %d", &a, &b);
result=power(a,b);
printf("%d raised to %d is %d", a, b, result);
}
power (int a, int b)
{
int calculation=1, calc;
for (calc=1; calc <=b; calc++)
{
calculation=calculation*a;
continue;
}
return(calculation);
}
The File can be found at:
Download File
ReplyDeleteVery informative article.Thank you author for posting this kind of article .
http://www.wikitechy.com/view-article/power-function-in-c-with-example-and-explanation
Both are really good,
Cheers,
Venkat