Saturday, March 4, 2017

Create an array of 10 000 random interger number elements array A Tạo Radom Array Integer trong C

Create an array of 10 000 random interger number elements array A Tạo Radom Array Integer trong C


Create an array of 10,000 random interger number elements (array A)
=========================================================================
27212   23947   7446    19659   1052    5771    21256   11110   32057   10666
26250   12670   13145   3925    31148   5874    25774   7043    9429    5536
6763    20016   21858   23934   7301    2061    32655   3815    21174   30582
10139   12082   14024   20900   1575    19337   15376   11300   19424   15864
20537   2695    18525   18629   22851   29788   30794   31744   21706   10075

T?o Radom v?i m?ng Integer trong C
C 2016
#include<stdio.h>
#include<stdlib.h>
#include<time.h>

int main()
{
int i;
int arraysize = 100;
//cho chay 100 vong test!
int numbers[arraysize];
//Khai bao mang kich thuoc 100
srand(time(NULL));
//Gan moi so Random vao mang thu i
for(i=0; i<arraysize ; i++){
numbers[i] = rand()%10000;
}
//In ra man hinh mang vua Random
for (i=0;i< arraysize;i++)
{
printf("%d ",numbers[i]);
}
return 0;
}

Go to link Download