This program can generate random number, from 0 to 6
#include<conio.h>
#include<stdlib.h>
#include<ctype.h>
#include<iomanip.h>
main()
{
srand(time(0));
clrscr();
for (int count=1; count<=5; count++)
{
int a=rand() % 6;
cout<<setw(5)<<a<<endl;
}
getche();
return 0;
}
CODING
#include<iostream.h>#include<conio.h>
#include<stdlib.h>
#include<ctype.h>
#include<iomanip.h>
main()
{
srand(time(0));
clrscr();
for (int count=1; count<=5; count++)
{
int a=rand() % 6;
cout<<setw(5)<<a<<endl;
}
getche();
return 0;
}
No comments:
Post a Comment