diff --git a/2207/C语言同步练习源码/3.数组-4.c b/2207/C语言同步练习源码/3.数组-4.c new file mode 100644 index 0000000..e22963b --- /dev/null +++ b/2207/C语言同步练习源码/3.数组-4.c @@ -0,0 +1,17 @@ +#include +#include +#include + +int main(){ + int num[10], i; + srand((unsigned)time(NULL)); + + for(i=0;i<10;i++){ + num[i] = rand()%101; + printf("%d ", num[i]); + } + printf("\n"); + + return 0; +} + diff --git a/2207/C语言同步练习答案.md b/2207/C语言同步练习答案.md index 4bf452e..9f4eb65 100644 --- a/2207/C语言同步练习答案.md +++ b/2207/C语言同步练习答案.md @@ -540,13 +540,29 @@ int main(){ } ``` - - ### 数组-4 ![image-20250220231447834](https://yp.smallkun.cn/markdown/image-20250220231447834.png!compress) +```c +#include +#include +#include +int main(){ + int num[10], i; + srand((unsigned)time(NULL)); + + for(i=0;i<10;i++){ + num[i] = rand()%101; + printf("%d ", num[i]); + } + printf("\n"); + + return 0; +} + +``` ### 数组-5