Q:

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

belongs to collection: C++ Basic Solved Programs

0

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.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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 .

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Basic Solved Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C++ Program to Find Sum and Average of three numbe... >>
<< Write a C++ Program to Display ASCII Value of a Ch...