How to write a code for random pick from 1-1000 numbers?
The output should contain the 10 numbers from the range
1-1000 which should pick randomly, ie ,for each time we run
the code we should get different outputs.
Answer Posted / navdeep singh
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int main(void)
{
int i;
randomize();
printf("Ten random numbers from 0 to 1000\n\n");
for(i=0; i<10; i++)
printf("%d\n", rand() % 100);
return 0;
}
| Is This Answer Correct ? | 15 Yes | 7 No |
Post New Answer View All Answers
How many levels of pointers have?
How can you call a function, given its name as a string?
Are pointers really faster than arrays?
How do you search data in a data file using random access method?
Why is this loop always executing once?
What is string constants?
What is the use of getch ()?
What is the difference between array and structure in c?
What is the easiest sorting method to use?
Explain how to reverse singly link list.
Define macros.
What is calloc()?
What is the scope of static variable in c?
What is nested structure in c?
What is the best way to comment out a section of code that contains comments?