Hi
It's my first post in this forum. :D
I am learning c# language and I want to do below project:
1- Input 10 numbers.
2- Sort them from smallest to biggest number.
3- Output biggest and smallet number.
How can I do it.
I did it like below but it was incorrect:
It's my first post in this forum. :D
I am learning c# language and I want to do below project:
1- Input 10 numbers.
2- Sort them from smallest to biggest number.
3- Output biggest and smallet number.
How can I do it.
I did it like below but it was incorrect:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication7
{
class Program
{
static void Main(string[] args)
{
int[] numbers = new int[4];
for(int i=0;i<numbers.Length;i++) {
int j = Convert.ToInt32(Console.ReadLine());
int small = numbers.Min();
int large = numbers.Max();
Console.WriteLine("The biggest: " + large);
Console.WriteLine("The smallest: " + small);
}
Console.ReadLine();
}
}
}
Comment