#include <stdio.h>
int main()
{
int x,y,i=1;
long int pow=1,s=0;
printf("\n Enter the value of x & y1:");
scanf("%d%d",&x,&y);
while(i<=y)
{
pow=pow*x;
s=s+pow;
i++;
}
printf{"\n Sum= %ld",s);
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: