Solved
Randomize numbers Question for gj62
Posted on 2003-03-13
Hi, here it is...
I first have to have this program randomly create 100 numbers in range of 1 to 999......
then:
a. Print the array ten values to the line.
b. Print the odd values, ten to a line.
c. Return count of the number of even values.
d. Return location of the smalles value in the array.....
// I believe I should be ok with a-d assignments as long as I get the numbers properly generated.//
I started off with 8 errors and after I read your first comment I'm down to 4.... Can you look at this code that I kinda fixed and tell me whats wrong here....
Oh, btw I'm posting 20 points only so please dont use too much of your time on it cause I don't have any more points, I'll make sure to give u some extra when I get more points...
I also don't understand what this is:
srand( (unsigned)time( NULL ) );
Thanks a lot... Here is what I got so far....
SOURCE CODE
********************************************************************************************************
#include <stdio.h>
#include <stdlib.h>
#define SIZE 100
int main (void)
{
int number [SIZE];
int num;
int i;
int max;
int a;
num = rand() % 999 +1;
for (i = 0; i < SIZE; i++);
{
number[i] = rand() % 999 + 1;
{
if (max % 3 ==0 || max % 7 == 0)
a[i] = -num;
else
a[i] = num;
} // to generate numbers
return 0;
}
}