Im getting some troubles in making a program that uses function to display results power of entered number with entered power and results are passed back to main(). See my code, there is something wrong, how can I make output?
Code:
#include<stdio.h>
int power(int a,int b)
{
int i,j;
for(i=1; i<b; i++)
{
a=a*a;
}
j=a;
return j;
}
void main()
{
int n,p;
printf("\nEnter number: ");
scanf("%d", &n);
printf("\nEnter Power: ");
scanf("%d", &p);
power(n,p);
}