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 / dayquest
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
void main()
{
int i;
randomize();
printf("\n Ten random numbers between 1 and 1000 are \n");
for(i=0;i<10;i++)
printf("%d ",random(1000)+1);
getch();
}
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above
What is malloc return c?
What is the scope of static variable in c?
What do you mean by a sequential access file?
What are file streams?
Are c and c++ the same?
What is the meaning of ?
What is difference between constant pointer and constant variable?
Can a pointer be static?
What are the uses of null pointers?
What the advantages of using Unions?
what will be maximum number of comparisons when number of elements are given?
What is main function in c?
Which function in C can be used to append a string to another string?
how to find anagram without using string functions using only loops in c programming