For this i need to write? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

For this i need to write?

display the quality of random number having value between 1 to 50 and the number having values greater than 50.

3rd May 2020, 5:18 PM
Kyrene
23 Answers
+ 1
You are welcome ☺️
4th May 2020, 4:15 AM
ycsvenom
ycsvenom - avatar
+ 4
Look I still didn't get what you want but here is the array int randomNum[30]; for (int i=0;i<30;i++) randomNum[i] =rand() %50; And here is the random number between 50 and 100 int randomNum50=(rand() +50)%100;
4th May 2020, 3:45 AM
ycsvenom
ycsvenom - avatar
+ 2
Can you explain what's the meaning of quality And I will tell you how
3rd May 2020, 5:36 PM
ycsvenom
ycsvenom - avatar
+ 2
For random number is rand() function, if you want number <= 50 you need to write rand() % 50; 👍
3rd May 2020, 5:42 PM
꧁༒☬Bad☬Boy☬༒꧂
꧁༒☬Bad☬Boy☬༒꧂ - avatar
+ 1
But in front of this is Fill an array of 30 integer number with random number that have be scaled to the range 1 to 100.
4th May 2020, 3:33 AM
Kyrene
+ 1
What is the meaning fo the back . display the quality of random number having value between 1 to 50 and the number having values greater than 50.
4th May 2020, 3:34 AM
Kyrene
+ 1
The Question ask the code to generate 30 random numbers where the value is between ‪1 - 100‬. Then count how many values are 1-50 and how many values are more than 50. Let's say we have 10 numbers : 25, 16, 86, 53, 46, 28, 77, 90, 11, 12 Quantity of 1-50 : 6 values ---> 25, 16, 46, 28, 11, 12 Quantity of >50 : 4 values ---> 86, 53, 77, 90
4th May 2020, 3:47 AM
Kyrene
+ 1
Now I get it But you typed quality in the question not quantity
4th May 2020, 3:49 AM
ycsvenom
ycsvenom - avatar
+ 1
I will give it to you its easy
4th May 2020, 3:49 AM
ycsvenom
ycsvenom - avatar
+ 1
Oh , sorry about that
4th May 2020, 3:49 AM
Kyrene
+ 1
Ok, thank you~
4th May 2020, 3:50 AM
Kyrene
+ 1
I write my code until here only #include <iostream> using namespace std; int main() { int randomNumber; for (int index = 0; index <30; index++) { randomNumber = (rand() % 100) ; cout << randomNumber << endl; } }
4th May 2020, 3:51 AM
Kyrene
+ 1
For this QUESTION need to use function
4th May 2020, 3:52 AM
Kyrene
4th May 2020, 4:05 AM
ycsvenom
ycsvenom - avatar
0
Function for what?
4th May 2020, 4:06 AM
ycsvenom
ycsvenom - avatar
0
For this code owo
4th May 2020, 4:07 AM
Kyrene
0
😂😂😂 I know but what the function will do in that question?
4th May 2020, 4:08 AM
ycsvenom
ycsvenom - avatar
0
Ya
4th May 2020, 4:08 AM
Kyrene
0
Is the code OK? Or you want some edits?
4th May 2020, 4:11 AM
ycsvenom
ycsvenom - avatar
0
I think is ok already ,thank you so much ❤
4th May 2020, 4:13 AM
Kyrene