Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / kameshwar

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
int i;
srand(time(NULL));
printf("\n Ten random numbers between 1 and 1000 are \n");
for(i=0;i<10;i++)
printf("%d ",(rand() % 1000) + 1);
return EXIT_SUCCESS;
}

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you print only part of a string?

1073


What are runtime error?

1180


What is #include called?

1105


Is r written in c?

1190


 write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare.  You will then tabulate this information in another file.

2286


Discuss the function of conditional operator, size of operator and comma operator with examples.

1216


How macro execution is faster than function ?

1251


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?

1557


Explain what is wrong with this statement? Myname = ?robin?;

1641


What is zero based addressing?

1239


Explain what standard functions are available to manipulate strings?

1130


What is the -> in c?

1069


What do you mean by Recursion Function?

1181


Array is an lvalue or not?

1192


What will be your course of action for a push operation?

1156