programming-examples/c++/Overview/C++ program to generate random numbers.cpp

20 lines
460 B
C++
Raw Permalink Normal View History

2019-11-18 14:44:36 +01:00
#include<iostream>
#include<cstdlib>
using namespace std;
main()
{
int n, max, num, c;
cout << "Enter the number of random numbers you want ";
cin >> n;
cout << "Enter the maximum value of random number ";
cin >> max;
cout << "random numbers from 0 to " << max << " are :-" << endl;
for ( c = 1 ; c <= n ; c++ )
{
num = random(max);
cout << num << endl;
}
return 0;
}