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 can you tell whether a program was compiled using c versus c++?

1047


How can a program be made to print the name of a source file where an error occurs?

1177


When is a null pointer used?

1066


Why can’t constant values be used to define an array’s initial size?

1328


Can we assign integer value to char in c?

1160


Why clrscr is used after variable declaration?

1625


In which language linux is written?

1169


What is structure in c language?

1099


What is the use of header files?

1060


What is non linear data structure in c?

970


Why c is called free form language?

971


What is the g value paradox?

1106


Write a program to print all permutations of a given string.

1130


What is omp_num_threads?

1041


Is there a built-in function in C that can be used for sorting data?

1184