Generate Randam Number
Code:
#include<iostream>
#include<conio.h>
#include<stdio.h>
#include<cstdlib>
using namespace std;
int random(int);// Prototype
void main()
{
int a;
cout<<"\n Please enter how many random number you want to generate :";
cin>>a;
random(a);
getch();
}
int random(int num)
{
if(num<=0)
{
return 0;
}
cout<<"\n ==>> "<<rand();
num--;
random(num);
}
Output:
#include<iostream>
#include<conio.h>
#include<stdio.h>
#include<cstdlib>
using namespace std;
int random(int);// Prototype
void main()
{
int a;
cout<<"\n Please enter how many random number you want to generate :";
cin>>a;
random(a);
getch();
}
int random(int num)
{
if(num<=0)
{
return 0;
}
cout<<"\n ==>> "<<rand();
num--;
random(num);
}
Output: