✔ 最佳答案
參考看看
#include <stdio.h>
int main() {
int i = 0;
int j = 0;
int sum = 0;
printf("Please input a number : ");
scanf("%d",&i);
for( j = 0; j < i; i--) {
sum = sum + ( i * i );
}
printf("Sum is : %d\n",sum);
return 0;
}
2009-07-18 00:03:57 補充:
我好像看錯了
sorry
2009-07-18 10:26:05 補充:
早上好
參考看看
#include
int retNum(int i);
int main() {
int i, j, y, z;
int sum = 0;
int retNum(int i) {
int tmp = i;
y = 1;
while( y < i ) {
tmp = tmp * i;
y++;
}
return tmp;
}
2009-07-18 10:26:12 補充:
printf("Please input a number : ");
scanf("%d",&i);
for( j = 0; j < i; i--) {
z = retNum(i);
sum = sum + z;
}
printf("Sum is : %d\n",sum);
return 0;
}
2009-07-18 10:26:39 補充:
報告完畢
2009-07-18 10:27:37 補充:
include stdio.h 不見了,請自加
2009-07-18 13:53:47 補充:
請在最後一個{
上加
system("PAUSE");
謝謝
2009-07-18 13:55:44 補充:
也就是
return 0;
system("PAUSE");
}
2009-07-19 12:49:25 補充:
錯了,是
system("PAUSE");
return 0;
}