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
Is javascript written in c?
What is the meaning of typedef struct in c?
how we can make 3d venturing graphics on outer interface
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
What is a macro, and explain how do you use it?
What is structure packing in c?
what is the difference between class and unio?
How do shell structures work?
How do you use a pointer to a function?
What is sizeof array in c?
What is adt in c programming?
How can I open files mentioned on the command line, and parse option flags?
For what purpose null pointer used?
Tell me can the size of an array be declared at runtime?