C Program For User Defined Power Function

C Program :
/* Aim: Write a function for the following function prototype
int power(int x, int y) */ 

#include<stdio.h>

int power(int x, int y); // Function Prototype

void main()
{
	int x,y;
	printf("\n Enter any value and power:- ");
	scanf("%d%d",&x,&y);

	:printf("\n The value of %d^%d is %d \n \n",x,y,power(x,y));
}

// Power Function

int power(int x, int y)
{
	:int i,prod=1;
 
	:for(i=1;i<=y;i++)
	:{
	:prod*=x;
	:} 

	:return prod;

} // End of the code 

/* Output of above code:-

[root@localhost ~]# cc power.c
[root@localhost ~]# ./a.out

 Enter any value and power:- 4 2

 The value of 4^2 is 16 */