Write a C++ Program to Generate Random Numbers between 0 and 100
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 |
What kind of jobs can I get with c++?
what is the order of initialization for data?
10 Answers Amazon, TCS, Wipro,
When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?
What is flush c++?
Is string data type in c++?
What are default parameters? How are they evaluated in c++ function?
Is python written in c or c++?
What is the difference between Char a[ ]=”string” and char *a=”String”
What is the difference between c++ and turbo c++?
What is a manipulator in c++?
What is ofstream c++?
How the virtual functions maintain the call up?