用C语言编写程序产生20个100以内的随机数,然后输出数组各元素。

如题所述

#include <stdio.h>

#include "stdlib.h"
#include "time.h"
int main(int argc,char *argv[]){
    int n,t[20];
    srand((unsigned)time(NULL));
    for(n=0;n<20;n++)
        printf("%3d",t[n++]=rand()%100);
    printf("\n");
    return 0;
}追问

这个是C++吧

这个是C++吧

温馨提示:答案为网友推荐,仅供参考
相似回答