#include <stdio.h>
#include<stdlib.h>
jx(int n)
{
int k,i=1;
while(i<=n)
{i++;
i*=i;
}
k=i;
return(k);
}
main()
{
int n,i=1;
int sum;
scanf("%d",&n);
while(i<=n)
{i++;
sum+=jx(i);
printf("sum:%d\n",sum);
printf("i=%d\n",i);
printf("jx=%d\n",jx(i));
}
printf("%d\n",sum);
system("pause");
}
/*
5
sum:2293676
i=2
jx=4
sum:2293680
i=3
jx=4
sum:2293705
i=4
jx=25
sum:2293730
i=5
jx=25
sum:2293755
i=6
jx=25
2293755
请按任意键继续. . .*/
最后一段是执行结果
#include<stdlib.h>
jx(int n)
{
int k,i=1;
while(i<=n)
{i++;
i*=i;
}
k=i;
return(k);
}
main()
{
int n,i=1;
int sum;
scanf("%d",&n);
while(i<=n)
{i++;
sum+=jx(i);
printf("sum:%d\n",sum);
printf("i=%d\n",i);
printf("jx=%d\n",jx(i));
}
printf("%d\n",sum);
system("pause");
}
/*
5
sum:2293676
i=2
jx=4
sum:2293680
i=3
jx=4
sum:2293705
i=4
jx=25
sum:2293730
i=5
jx=25
sum:2293755
i=6
jx=25
2293755
请按任意键继续. . .*/
最后一段是执行结果