sum*=sum问题
#include"stdio.h"int main (void)
{int j,k,o;
long int sum=1,i[4];
printf("\n\n\n\n");
printf("%32s\n\n","::::: 乘 方 表 :::::");
printf("%5s%7s%7s%9s%9s\n%5s%7s%7s%8s%9s\n\n",
"整数","平方","立方","四次方","五次方",
"-----","-----","-----","-----","-----");
printf("请输入一个整数:");
scanf("%d",&o);
for(j=1;j<=o;j++){
sum=j;
for(k=0;k<=3;k++){
sum*=sum;
i[k]=sum;};
printf("%5u%7u%7u%8u%9u\n",
j,i[0],i[1],i[2],i[3]);};
getchar();}
程序运行时平方和四次方的值为0;
是不是sum*=sum那条语句有问题,但是我不知道为什么错了.
[此贴子已经被作者于2007-2-1 17:30:55编辑过]