第2个回答 2016-04-06
看代码:
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
#include <stdio.h>
#include <stdlib.h>
void print_arr (int* a, int n)
{
int i = 0;
for (; i < n; ++i)
{
printf ("%d ", a[i]);
if ((i+1) % 10 == 0)
{
printf("\n");
}
}
printf("\n");
}
#define N 50
int main(int argc, char** argv)
{
srand(time(NULL)); // 设置当前时间为随机数种子
int a[N], i;
for (i = 0; i < N; i++)
{
a[i] = rand() % 100 + 100;
}
print_arr(a, N);
return 0;
}本回答被网友采纳