Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
using System.IO;
using System;
class Program
{
static void Main()
{
Console.WriteLine("Enter 3 fruits");
Console.WriteLine();
string fruit = String.Empty;
string[] fruitList = new string[3];
for (int x = 0; x < 3; x++)
{
fruitList[x] = Console.ReadLine();
}
for (int i = 0; i < fruitList.Length; i++)
{
for (int j = i + 1; j < fruitList.Length; j++)
{
if (fruitList[i].Length < fruitList[j].Length)
{
fruit = fruitList[i];
fruitList[i] = fruitList[j];
fruitList[j] = fruit;
}
}
Console.WriteLine(fruitList[i]);
}
}
}
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more