+ 3
How can I generate 6 randon numbers between 1 & 100 in my program
3 Antworten
+ 12
In C++:
#include <iostream>
using namespace std;
int main()
{
srand(time(0));
for(int i = 0; i < 6; ++i) {
cout << ((rand() % 100) + 1) << endl;
}
return 0;
}
+ 4
in which language please ?
in python for one number it is :
import random
var=random.randint(6,100)
+ 1
loop 1 to 6
and generate a random no. in each loop