#include<stdio.h>
int powers(int m,int n)
{
int i,sum=1;
for (i=0;i<n;i++)
{
sum*=m;
}
return sum;
}
int sum_of_powers(int k,int n)
{
int i,sum=0;
for(i=1;i<=n;i++)
sum+=powers(i,k);
return sum;
}
int main()
{
int a,b;
while(1)
{
printf("input number");
scanf("%d%d",&a,&b);
printf("sum of %d powers of intergers from 1 to %d =%d\n",a,b,sum_of_powers(a,b));
}
return 0;
}
int powers(int m,int n)
{
int i,sum=1;
for (i=0;i<n;i++)
{
sum*=m;
}
return sum;
}
int sum_of_powers(int k,int n)
{
int i,sum=0;
for(i=1;i<=n;i++)
sum+=powers(i,k);
return sum;
}
int main()
{
int a,b;
while(1)
{
printf("input number");
scanf("%d%d",&a,&b);
printf("sum of %d powers of intergers from 1 to %d =%d\n",a,b,sum_of_powers(a,b));
}
return 0;
}