-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp04ex01.c
More file actions
46 lines (40 loc) · 699 Bytes
/
Copy pathp04ex01.c
File metadata and controls
46 lines (40 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*** p04ex01.c ***/
/*** ps20 ***/
#include <stdio.h>
int main()
{
int score[10] = {15, 8, 12, 18, 20, 20, 9, 16, 20, 17};
int count;
int i;
int num;
for (count = 0; count < 10; count++)
{
num = count + 1;
printf("%2d %2d :", num, score[count]);
for (i = 1; i <= score[count]; i++)
{
if (i % 5 == 0)
{
printf("|");
}
else
{
printf("*");
}
}
printf("\n");
}
return 0;
}
/*** 結果 ***
1 15 :****|****|****|
2 8 :****|***
3 12 :****|****|**
4 18 :****|****|****|***
5 20 :****|****|****|****|
6 20 :****|****|****|****|
7 9 :****|****
8 16 :****|****|****|*
9 20 :****|****|****|****|
10 17 :****|****|****|**
*************/