Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(USING VISUAL STUDIOS) }Ch.10 PE 3 (Simplified, ENHANCED) Write a program } that

ID: 3594665 • Letter: #

Question

(USING VISUAL STUDIOS)

}Ch.10 PE 3 (Simplified, ENHANCED) Write a program

} that accepts a list of numbers until a non-numeric is encountered (up to 30 numbers), putting the numbers into an array, and keeping track of how many numbers were inserted. Then it should scan thru the array to find the largest number, and print the largest.

}(Sample program output shown underlined. You may choose to fill the array just once, or keep filling & searching until the user enters q alone):

}Type integer numbers, followed by q to quit: 1 2 3 4 q

}The largest number: 4

}

}Type integer numbers, followed by q to quit: -999 1111 22 7 77 99 -9 33 44 5 q

}The largest number: 1111

}

}Type integer numbers, followed by q to quit: q

}Goodbye!

Explanation / Answer

using System;

class Program
{
static void Main()
{
int max = 0;
string input;
int number;
Console.WriteLine("Type integer numbers, followed by q to quit: ");
input = Console.ReadLine();
while(!input.Equals("q")){
Int32.TryParse(input, out number);
if(number > max)
max = number;
input = Console.ReadLine();
}
Console.WriteLine("The largest number: " + max);
}
}