Write a C program to calculate the x to the power y without using standard function.


#include<stdio.h>
#include<conio.h>
void main()
{
int i,x,y, ans;
clrscr();
ans=1;
printf("Enter the value of x");
scanf("%d", &x);
printf("Enter the value of y");
scanf("%d", &y);
for(i=1; i<=y; i++)
{
ans= ans*x;
}
printf(" %d to the power %d is %d", x, y, ans);
getch();
}
/* output
Enter the value of x2
Enter the value of y3
 2 to the power 3 is 8 */