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
What is anagram in c?
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
Explain the difference between null pointer and void pointer.
Does * p ++ increment p or what it points to?
What is string in c language?
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
What are the types of data types and explain?
write a c program in such a way that if we enter the today date the output should be next day's date.
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
Is register a keyword in c?
What is the use of typedef in structure in c?
How to establish connection with oracle database software from c language?
4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
Where register variables are stored in c?