0
Why does not the code always print 10? Why is it so || Почему код не вывод всегда 10? Почему так получается
#include <iostream> #include <cstdlib> using namespace std; int main () { for (int x = 1; x <= 10; x++) { cout << x + (rand() % 6) << endl; } }
2 ответов
+ 4
I guess you want random values
for (int x = 1; x <= 10; x++) {
cout << (rand() % 6)+1 << endl;
}
edit:
You want to print random value 10 times or 10 ten times?
https://www.sololearn.com/Discuss/1386663/?ref=app
https://www.sololearn.com/Discuss/122840/?ref=app
+ 1
Daljeet Singh And here it is