0% found this document useful (0 votes)
17 views

#Include #Include: STD Main N, Max, Num, C

This C++ program generates random numbers between 0 and a user-specified maximum value. The user is prompted to enter the number of random numbers to generate and the maximum value. A for loop then generates that number of random integers within the given range, printing each value.

Uploaded by

abhi kr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

#Include #Include: STD Main N, Max, Num, C

This C++ program generates random numbers between 0 and a user-specified maximum value. The user is prompted to enter the number of random numbers to generate and the maximum value. A for loop then generates that number of random integers within the given range, printing each value.

Uploaded by

abhi kr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Random numbers

#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;

You might also like