Writing a c program to create a random array
#define ASIZE 10
int array[ASIZE];
int temp=0, i=0;
// Initialize array of random numbers
srand ( time(NULL) );
while((temp = (rand() % 100)!=0) && (i < ASIZE)){
array[i] = temp;
i++;
}
printf("This is the new array [");
for(i=0; i<ASIZE; i++)
{
printf("%d, ", array[i]);
}
printf("]\n\t");
my output is:
This is the new array [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ]