Answer to Question #13686 in C# for kimie

Question #13686
Write a program that will ask the user to enter 100 numbers and display on the screen the highest and lowest of these numbers.
1
Expert's answer
2012-08-30T09:43:16-0400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
& static void Main(string[] args)
& {

int[] array = new int[100];

for (int i = 0; i < 100; i++)
{
array[i] = int.Parse(Console.ReadLine());
}
int max = array[0], min = array[0];
for (int i = 1; i < 100; i++)
{
if (array[i] > max) max = array[i];
if (array[i] < min) min = array[i];
}
Console.WriteLine("Max: " + max + "\nMin: " + min);
& }
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS