using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
int[] io=new int[3]{5,4,6};
Console.WriteLine("Sam is working on an application wherein he needs to accept the size of a one dimensional array and its values. He needs to identify the largest and smallest number in the array and based on that he needs to display the result. Help him to create the application. ");
if(io[0]>io[1] && io[0]>io[2])
{
Console.WriteLine("the largest number is:" + io[0]);
}
if (io[1] > io[0] && io[1] > io[2])
{
Console.WriteLine("the largest number is:" + io[1]);
}
if (io[2] > io[0] && io[2] > io[1])
{
Console.WriteLine("the largest number is:" + io[2]);
}
if (io[0] < io[1] && io[0] < io[2])
{
Console.WriteLine("the smallest number is:" + io[0]);
}
if (io[1] < io[0] && io[1] < io[2])
{
Console.WriteLine("the smallest number is:" + io[1]);
}
if (io[2] < io[0] && io[2] < io[1])
{
Console.WriteLine("the smallest number is:" + io[2]);
}
Console.ReadLine();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
int[] io=new int[3]{5,4,6};
Console.WriteLine("Sam is working on an application wherein he needs to accept the size of a one dimensional array and its values. He needs to identify the largest and smallest number in the array and based on that he needs to display the result. Help him to create the application. ");
if(io[0]>io[1] && io[0]>io[2])
{
Console.WriteLine("the largest number is:" + io[0]);
}
if (io[1] > io[0] && io[1] > io[2])
{
Console.WriteLine("the largest number is:" + io[1]);
}
if (io[2] > io[0] && io[2] > io[1])
{
Console.WriteLine("the largest number is:" + io[2]);
}
if (io[0] < io[1] && io[0] < io[2])
{
Console.WriteLine("the smallest number is:" + io[0]);
}
if (io[1] < io[0] && io[1] < io[2])
{
Console.WriteLine("the smallest number is:" + io[1]);
}
if (io[2] < io[0] && io[2] < io[1])
{
Console.WriteLine("the smallest number is:" + io[2]);
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment