# 程式不會寫請大大幫忙~~!!

.A計算及列印1+2+...+N的結果

B 計算及列印1~N之中所有偶數和

a.列印成績總和

b.列印平均成績

c.列印最高分

d.列印最低分

3 x 1 = 3 3 x 2 = 6 ... 3 x 9 = 27

...

9 x 1 = 9 9 x 2 = 18 ... 9 x 9 = 81

### 4 個解答

• 8 年前
最佳解答

#include "stdafx.h"

#include "stdlib.h"

#include "stdio.h"

int _tmain(int argc, _TCHAR* argv[])

{

int n = 0;

int i = 0, j = 0;

printf("1+2+...+n, Enter n \n");

scanf("%d",&n);

for(i = 1; i <= n; i++)

j = j + i;

printf("1+...+n = %d \n", j);

int even = 0;

printf("sum of the even, Enter n \n");

scanf("%d",&n);

for(i = 1; i<= n; i++)

{

if(i % 2 == 0)

{

even = even + i;

}

}

printf("sum of the even 'n' = %d \n", even);

printf("Enter the ten student achievement\n");

int student[10]; // 0 ~ 9 = 10位學生

float sum = 0, average = 0;

int k = 0, max = 0, min = 100;

while(k != 10)

{

scanf("%d", &student[k]);

k += 1;

}

for(k = 0; k< 10 ; k++)

sum = sum + student[k];

average = sum / k;

for (k = 0; k < 10; k++)

{

if (student[k] > max)

{

max = student[k];

}

else if(student[k] < min)

{

min = student[k];

}

}

printf("total = %f \n", sum);

printf("average = %4.3f \n", average);

printf("max = %d \n", max);

printf("min = %d \n", min);

i = 1;

j = 1;

while(i <= 9)

{

while(j <= 9)

{

printf("%dx%d=%d ",i ,j ,i*j);

j += 1;

}

printf("\n");

j = 1;

i += 1;

}

system("Pause");

return 0;

}

2012-10-07 14:16:50 補充：

知識加顯示不正常

for(i = 1; i<=n; i++)

j = j + i;

printf("1+...+n = %d \n", j);

參考資料： me
• 8 年前

其實根本沒有教過= =不果很謝謝幫忙

• 8 年前

99乘法表不是上程式課必定會出現的嗎?

• 8 年前

都沒有教過是指沒有教過while、

還是沒有教過寫99乘法表的程式碼、

還是沒有教過99乘法表?