Ask Question
26 October, 19:18

Find the largest number. The process of finding the maximum value (i. e., the largest of a group of values) is used frequently in computer applications. For example, an app that determines the winner of a sales contest would input the number of units sold by each salesperson. The sales person who sells the most units wins the contest. Write pseudocode, then a C# app that inputs a series of 10 integers, then determines and displays the largest integer. Your app should use at least the following three variables:

Counter: Acounter to count to 10 (i. e., to keep track of how many nimbers have been input and to determine when all 10 numbers have been processed).

Number: The integer most recently input by the user.

Largest: The largest number found so far.

+4
Answers (1)
  1. 26 October, 22:13
    0
    See Explanation

    Explanation:

    Required

    - Pseudocode to determine the largest of 10 numbers

    - C# program to determine the largest of 10 numbers

    The pseudocode and program makes use of a 1 dimensional array to accept input for the 10 numbers;

    The largest of the 10 numbers is then saved in variable Largest and printed afterwards.

    Pseudocode (Number lines are used for indentation to illustrate the program flow)

    1. Start:

    2. Declare Number as 1 dimensional array of 10 integers

    3. Initialize: counter = 0

    4. Do:

    4.1 Display "Enter Number " + (counter + 1)

    4.2 Accept input for Number[counter]

    4.3 While counter < 10

    5. Initialize: Largest = Number[0]

    6. Loop: i = 0 to 10

    6.1 if Largest < Number[i] Then

    6.2 Largest = Number[i]

    6.3 End Loop:

    7. Display "The largest input is "+Largest

    8. Stop

    C# Program (Console)

    Comments are used for explanatory purpose

    using System;

    namespace ConsoleApplication1

    {

    class Program

    {

    static void Main (string[] args)

    {

    int[] Number = new int[10]; / / Declare array of 10 elements

    //Accept Input

    int counter = 0;

    while (counter<10)

    {

    Console. WriteLine ("Enter Number " + (counter + 1) + ": ");

    string var = Console. ReadLine ();

    Number[counter] = Convert. ToInt32 (var);

    counter++;

    }

    //Initialize largest to first element of the array

    int Largest = Number[0];

    //Determine Largest

    for (int i=0; i<10; i++)

    {

    if (Largest < Number[i])

    {

    Largest = Number[i];

    }

    }

    //Print Largest

    Console. WriteLine ("The largest input is " + Largest);

    Console. ReadLine ();

    }

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Find the largest number. The process of finding the maximum value (i. e., the largest of a group of values) is used frequently in computer ...” in 📘 Engineering if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers