+ 3

How can I generate 6 randon numbers between 1 & 100 in my program

8th Mar 2017, 2:21 PM
Perican Bongani Sithole
Perican Bongani Sithole - avatar
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; }
8th Mar 2017, 2:59 PM
Jafca
Jafca - avatar
+ 4
in which language please ? in python for one number it is : import random var=random.randint(6,100)
8th Mar 2017, 2:23 PM
Hbeo
Hbeo - avatar
+ 1
loop 1 to 6 and generate a random no. in each loop
8th Mar 2017, 2:41 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar