public static void MaximumMinimumElementArray(){ int[] array = { 10, 30, 40,100,170, 50, 20, 60 }; int max = array[0]; int min = array[0]; for (int i=0; i<=array.Length-1; i++) { if(array[i] > max) { max = array[i]; } if(array[i] < min) { min = array[i]; } } Console.WriteLine(max); Console.WriteLine(min);}
public static void MaximumMinimumElementArray()
{
int[] array = { 10, 30, 40,100,170, 50, 20, 60 };
int max = array[0];
int min = array[0];
for (int i=0; i<=array.Length-1; i++)
if(array[i] > max)
max = array[i];
}
if(array[i] < min)
min = array[i];
Console.WriteLine(max);
Console.WriteLine(min);
Hi Shaikh,
using System;using System.Linq;public class Example{ public static void Main() { int[] arr = { 8, 3, 5, -1, 2 }; Console.WriteLine("Minimum number is " + arr.Min()); Console.WriteLine("Maximum number is " + arr.Max()); }}
using System;
using System.Linq;
public class Example
public static void Main()
int[] arr = { 8, 3, 5, -1, 2 };
Console.WriteLine("Minimum number is " + arr.Min());
Console.WriteLine("Maximum number is " + arr.Max());
public static void MaxMinElementArray() {int[] array = { 10, 30, 40,100,170, 50, 20, 60 };Array.Sort(array);var last=array.Length-1;int max = array[last];int min = array[]; Console.WriteLine(max);Console.WriteLine(min); }}
static void Main(){int[] array = { 10, -10, -20, 0,15,20,30 };Console.WriteLine("Maximum Element : " +array.Max());Console.WriteLine("Minimum Element : " +array.Min());Console.Read();}