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
Why should I use standard library functions instead of writing my own?
What is c standard library?
Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?
Explain how can you check to see whether a symbol is defined?
What is c language in simple words?
Why dont c comments nest?
Can we assign string to char pointer?
What is the use of bitwise operator?
Can true be a variable name in c?
Is r written in c?
What does return 1 means in c?
How is a pointer variable declared?
What is a built-in function in C?
How many levels of pointers can you have?
How can I find the modification date and time of a file?