A simple program to check which of the given numbers has the smallest and biggest numerical value using C# programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGgThank you very much for your support.

Program Listing

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int i=0;
            int[] items = new int[100];
            Console.Write("\n\n");
            Console.Write("\tThe Smallest and Biggest Number in C#");
            Console.Write("\n\n");
            Console.Write("\tHow Many Items?  ");
            int n = Convert.ToInt16(Console.ReadLine());
            Console.Write("\n\n");
            for (i = 1; i <= n; i++)
            {
                Console.Write("\tEnter the No. " + i + ": ");
                items[i] = Convert.ToInt16(Console.ReadLine());
            }
            for (i = 1; i <= n; i++)
            {
                for (int j = 1; j <= n - 1; j++)
                {
                    if (items[j] > items[j + 1])
                    {
                        int temp = items[j];
                        items[j] = items[j + 1];
                        items[j + 1] = temp;
                    }
                }
            }
            Console.Write("\n\n");
            //Display the Smallest Numerical Value
            Console.WriteLine("\tThe Smallest Numerical Value : " + items[1]);
            //Display the Biggest Numerical Value
            Console.WriteLine("\tThe Largest Numerical Value  : " + items[n]);
              
            Console.Write("\n\n");
            Console.Write("\tThe End of Program");
            Console.Write("\n\n");
            Console.ReadKey();  
        }
    }
}

Leave a Reply

Your email address will not be published.