Program that computes x raised to the power y for the integers x and y and returns a double-type value.

#include<stdio.h>
double pow(int x,int y)
{ int total=1,i;
for(i=0;i<y;i++)
total*=x;
return total;
}
main()
{ int x,y;
double total;
printf("\n Enter the value of X(base) and Y(Power)!!!!");
scanf("%d%d",&x,&y);
total= pow( x, y);
printf("\nValue of X^y is=%lf",total);
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s