#include <conio.h>
#include <time.h>
int i = 1;
int main()
{
int nums[20];
srand(time(NULL));
while(i < 20){
nums[i] = rand()% 10;
i++;
}
printf("%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n", nums[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]);
}
when I run this code I am given values I expect, Ie under 10, except for the values for 2, 3, and 4, and more often than not 4 is negative.... Any help on what I have done wrong would be appriciated
printf("%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n", nums[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]);could perhaps be written more clearly. In fact, I don't think the last argument makes any sense