write, compile and test a short program to read in a list of 10 positive numbers which also determines and prints out the largest number.
here's what i've got so far. but how do i change it in order for it to accept a positive number only?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int [] numbers = new int[10] ;
int largest = 0;
for (int I = 0; I <= 9; I++)
{
Console.WriteLine("Enter a number"); //Writes the specified data, followed by the current line terminator, to the standard output stream.
numbers[I] = int.Parse(Console.ReadLine());
Console.WriteLine();
if (numbers[I] > largest)
largest = numbers[I];
}
Console.WriteLine("The largest number entered is " + largest.);
Console.ReadLine();//Reads a line of characters from the current stream and returns the data as a string.
}
}
}