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...

Write a C++ Program to Generate Random Numbers between 0 and 100

Answer Posted / hr

Solution:
/* C++ Program to Generate Random Numbers between 0 and 100 */
#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
int i; //loop counter
int num; //store random number
cout<<"Generating Random Numbers Below ::

";
for(i=1;i<=10;i++)
{
num=rand()%100; //get random number
cout<<" "<<num<<" ";
}
cout<<"
";
return 0;
}
Output:
/* C++ Program to Generate Random Number between 0 and 100 */
Generating Random Numbers Below ::
41 67 34 0 69 24 78 58 62 64
Process returned 0

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What will strcmp("Astring", "Astring"); return a) A positive value b) A negative value c) Zero

1056


What is class in c++ with example?

1132


What is pure virtual function? Or what is abstract class?

1008


What is lambda expression c++?

1005


How does atoi function work?

1103


What is format for defining a structure?

1038


What are smart pointers?

2171


How do you establish an is-a relationship?

1079


What is the basic structure of a c++ program?

1081


What do you mean by const correctness?

1033


Is it possible to provide special behavior for one instance of a template but not for other instances?

1060


Is c++ the hardest programming language?

1075


What is static function? Explain with an example

1001


Write a program that takes a 5 digit number and calculates 2 power that number and prints it.

2530


What is a dangling pointer in c++?

1091