answersLogoWhite

0

WARNING: This program will not work for x power y where the resulting value is greater than 32767. Example: 10 power 10 will give you an incorrect value.

#include <stdio.h>

int main()

{

int num, power,i,ans;

printf("Enter number and power\t");

scanf("%d%d",&num,&power);

ans=num;

for(i=1;i<power;i++)

ans=ans*num;

printf("%d to the power %d = %d",num,power,ans);

return 0;

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions