Write a C++ Program to Generate Random Numbers between 0 and 100. Here’s simple C++ Program to Generate Random Numbers between 0 and 100 in C++ Programming Language.
Here is source code of the C++ Program to Generate Random Numbers. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.
SOURCE CODE : :
/* 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 :: \n\n";
for(i=1;i<=10;i++)
{
num=rand()%100; //get random number
cout<<" "<<num<<" ";
}
cout<<"\n";
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
Above is the source code for C++ Program to Generate Random Number between 0 and 100 which is successfully compiled and run on Windows System.The Output of the program is shown above .
Here is source code of the C++ Program to Generate Random Numbers. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.
SOURCE CODE : :
Output : :
Above is the source code for C++ Program to Generate Random Number between 0 and 100 which is successfully compiled and run on Windows System.The Output of the program is shown above .
need an explanation for this answer? contact us directly to get an explanation for this answer