how would I store a random number generator into the array?
Code:
#include <stdio.h>
#include <conio.h>
#define MAX_SIZE 100//part 2
int main(void)
//Declaring Statements
{
int i;
int list[MAX_SIZE]={i};//part 2
int numPrinted=0;//part 2
srand (time(NULL));
{
printf("Numbers Unsorted:\n");
}
while(i<100)
for (i=0;i<MAX_SIZE; i++)
{
printf("%3d, %3d", rand()%1000, list[i]);
if (numPrinted <9)
numPrinted++;
else
{
printf("\n");
numPrinted=0;
}
}
return 0;
}
because if i tried to implement the random number generator to store into the array, the output would keep resulting in printing out 1 number. my goal is to print out 100 random numbers and store them while still having the out put to have at least 10 numbers per line.
for example: when i put in for(i=0; i<100; i++)
list[MAX_SIZE]=rand()%1000;