ive been tryin to figure out how to program this for nearly 6 hours straight no joke. still i couldnt. Basically i just want to create a program that can separate odd and even numbers from the generated random numbers and then storing it to the array.
my code so far..
btw im using linux emacs for this
int ran_num, i, eve_num, odd_num;
for(i = 0; i <= 10; i++)
ran_num = (10.0*rand()/(RAND_MAX+1.0));
if (arr[ran_num] %2 == 0)
printf("Even No.s : %d\n", eve_num);
printf("Odd No.s : %d\n", odd_num);
I also tried swaping codes .. i gave everything i got but still it wouldnt work. I also tried inserting the IF Else statement inside For and its giving me wrong answer too.