April 19, 2020

How to write a program in C# to display highest of any 10 number entered.

Write a program to display the highest of any 10 numbers entered.

How to write a program in C# to display highest of any 10 number entered.

Sample Solution

C# Sharp Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int I, n1, max = 0;
            Console.WriteLine("Enter any Number 10 times ");
            for (I = 0; I <= 9; I++)
            {
                n1 = Convert.ToInt32(Console.ReadLine());
                if (n1 > max)
                {
                    max = n1;
                }
            }
            Console.WriteLine("The largest number is:" + max);
            Console.ReadLine();
        }
    }
}


                                                            Sample Output

How to write a program in C# to display highest of any 10 number entered.




No comments:

Post a Comment