The image below is the assignment, and above that is the code written to solve it... Please explain each step to me with "//" !!   using System.IO; using System; class Program{     static void Main(){         double [] lst = new double[5];         int i= 0, m;         while (i < 5){             Console.WriteLine("Please enter the number(10-100)");             lst[i]= Convert.ToDouble(Console.ReadLine());             if(lst[i]<10 && lst[i]>100){                 Console.WriteLine("The number is outside the range");                 break;             }             int dpc = 0;             for (int k = 0; k < i; k++) {                 if (lst[k] == lst[i]) {                     Console.WriteLine("Please don't enter duplicates");                     dpc = 1;                     break;                 }             }             if(dpc==0)                 i++;         }         Console.WriteLine("The entered numbers are below");         for(m=0;m < 5;m++)             Console.WriteLine(lst[m]);     } }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

The image below is the assignment, and above that is the code written to solve it...
Please explain each step to me with "//" !!

 

using System.IO;
using System;
class Program{
    static void Main(){
        double [] lst = new double[5];
        int i= 0, m;
        while (i < 5){
            Console.WriteLine("Please enter the number(10-100)");
            lst[i]= Convert.ToDouble(Console.ReadLine());
            if(lst[i]<10 && lst[i]>100){
                Console.WriteLine("The number is outside the range");
                break;
            }
            int dpc = 0;
            for (int k = 0; k < i; k++) {
                if (lst[k] == lst[i]) {
                    Console.WriteLine("Please don't enter duplicates");
                    dpc = 1;
                    break;
                }
            }
            if(dpc==0)
                i++;
        }
        Console.WriteLine("The entered numbers are below");
        for(m=0;m < 5;m++)
            Console.WriteLine(lst[m]);
    }
}

Use a one-dimensional array to solve the following problem: Write an app that inputs five numbers, each
between 10 and 100, inclusive. As each number is read, display only if it's not a duplicate of a number already
read. Provide for the "worst case," in which all five numbers are different. Use the smallest possible array to
solve this problem. Display the complete set of unique values after the user inputs each new value.
Transcribed Image Text:Use a one-dimensional array to solve the following problem: Write an app that inputs five numbers, each between 10 and 100, inclusive. As each number is read, display only if it's not a duplicate of a number already read. Provide for the "worst case," in which all five numbers are different. Use the smallest possible array to solve this problem. Display the complete set of unique values after the user inputs each new value.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY