using System; class main { publicstaticvoid Main(string[] args) { int number = 1; while (number <= 88) { int i; Random r = new Random(); int[] randNo=newint[3]; for(i=0;i<3;i++) { randNo[i]= r.Next(1,88); Console.WriteLine("Random Number between 1 and 88 is "+randNo[i]); } } } }   This code is supposed to count from 1-88 and then select three random numbers from the list but instead it generates an infinite loop of random numers between 1-88. how can it be fixed

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
using System;

class main
{
publicstaticvoid Main(string[] args)
{
int number = 1;
while (number <= 88)
{
int i;
Random r = new Random();
int[] randNo=newint[3];
for(i=0;i<3;i++)
{
randNo[i]= r.Next(1,88);
Console.WriteLine("Random Number between 1 and 88 is "+randNo[i]);
}
}
}
}
 
This code is supposed to count from 1-88 and then select three random numbers from the list but instead it generates an infinite loop of random numers between 1-88. how can it be fixed?
Run
8* Invite
main.cs
Console
Shell
1
using System;
Random Number between 1 and 88 is 25
Random Number between 1 and 88 is 66
3
class main
Random Number between 1 and 88 is 2
Random Number between 1 and 88 is 48
Random Number between 1 and 88 is
Random Number between I and 88 is 5
Random Nurdber between 1 and 88 13 39
4.
public static void Main(string[] args)
{
int number = 1;
Bandom Number between 1 and 88 iz 43
Bandom Number between 1 and 88 iz 51
Bandom Number between 1 and 88 iz 5
Bandom Number between 1 and 88 iz 52
Bandom Number between 1 and 88 iz 36
Bandom Number between 1 and 88 iz 59
Bandom Number between 1 and 88 ia 49
Bandom Number between 1 and 88 iz 6
Random Number between 1 and 88 ia 30
Random Number between 1 and 88 is 23
Random Number between 1 and 88 is 5
Random Number between 1 and 88 is 66
Random Number between 1 and 88 is 50
Random Number between 1 and 88 is 79
1 and 88 is 17
Random Number between 1 and 88 is 61
while (number <= 88)
{
int i;
9
10
11
Random r - new Random(();
12
int[] randNo=new int[3];
for (i=0;i<3;i++)
13
14
{
15
randNo[i]= r.Next (1,88);
16
Console.WriteLine("Random Number between 1 and 88 is "+randNo[i]);
17
18
19
}
Random Number between 1
20
Random Number between 1 and 88 is 43
Random Number between 1 and 88 is 23
Random Number between 1 and 88 is 22
Random Number between 1 and 88 is 63
Random Number between 1 and 88 is 39
Random Number between 1 and 88 is 12
Random Number between 1 and 88 is 4
Random Number between 1 and 88 is 30
Random Number between 1 and 88 is 42
Random Number between 1 and 88 is 77
Random Number between 1 and 88 is 44
Random Number between 1 and 88 is 30
Random Number between 1 and 88 is 33
Random Number between 1 and 88 is 38
Random Number between 1 and 88 is 22
Random Number between 1 and 88 is 8
Random Number between 1 and 88 is 86
Random Number between 1 and 88 is 64
Random Number between 1 and 88 is 59
Random Number between 1 and 88 is 49
Random Number between 1 and 88 is 84
Random Number between 1 and 88 is 26
Random Number between 1 and 88 is 74
Random Number between 1 and 88 is 76
Random Number between 1 and 88 is 69: signal: terminated
Transcribed Image Text:Run 8* Invite main.cs Console Shell 1 using System; Random Number between 1 and 88 is 25 Random Number between 1 and 88 is 66 3 class main Random Number between 1 and 88 is 2 Random Number between 1 and 88 is 48 Random Number between 1 and 88 is Random Number between I and 88 is 5 Random Nurdber between 1 and 88 13 39 4. public static void Main(string[] args) { int number = 1; Bandom Number between 1 and 88 iz 43 Bandom Number between 1 and 88 iz 51 Bandom Number between 1 and 88 iz 5 Bandom Number between 1 and 88 iz 52 Bandom Number between 1 and 88 iz 36 Bandom Number between 1 and 88 iz 59 Bandom Number between 1 and 88 ia 49 Bandom Number between 1 and 88 iz 6 Random Number between 1 and 88 ia 30 Random Number between 1 and 88 is 23 Random Number between 1 and 88 is 5 Random Number between 1 and 88 is 66 Random Number between 1 and 88 is 50 Random Number between 1 and 88 is 79 1 and 88 is 17 Random Number between 1 and 88 is 61 while (number <= 88) { int i; 9 10 11 Random r - new Random((); 12 int[] randNo=new int[3]; for (i=0;i<3;i++) 13 14 { 15 randNo[i]= r.Next (1,88); 16 Console.WriteLine("Random Number between 1 and 88 is "+randNo[i]); 17 18 19 } Random Number between 1 20 Random Number between 1 and 88 is 43 Random Number between 1 and 88 is 23 Random Number between 1 and 88 is 22 Random Number between 1 and 88 is 63 Random Number between 1 and 88 is 39 Random Number between 1 and 88 is 12 Random Number between 1 and 88 is 4 Random Number between 1 and 88 is 30 Random Number between 1 and 88 is 42 Random Number between 1 and 88 is 77 Random Number between 1 and 88 is 44 Random Number between 1 and 88 is 30 Random Number between 1 and 88 is 33 Random Number between 1 and 88 is 38 Random Number between 1 and 88 is 22 Random Number between 1 and 88 is 8 Random Number between 1 and 88 is 86 Random Number between 1 and 88 is 64 Random Number between 1 and 88 is 59 Random Number between 1 and 88 is 49 Random Number between 1 and 88 is 84 Random Number between 1 and 88 is 26 Random Number between 1 and 88 is 74 Random Number between 1 and 88 is 76 Random Number between 1 and 88 is 69: signal: terminated
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education