采样1

#include<stdio.h>
#include<math.h>
#include<time.h>
#include<stdlib.h>
#define N 5

int main()
{
int number;
int i;

srand(time(0));

for(i=0;i<N;++i){
number = rand()%500+1;
printf("20228329%04d\n",number);
}

return 0;

}

line15的功能是生成一个1-500的随机数并赋值给number

程序的功能是随机生成五个2022级新生的学号

posted @ 2022-10-19 09:24  李龙圭  阅读(32)  评论(0)    收藏  举报