Overview:
In this article i would like to publish an article To Find the Largest Number using Arrays in c#.Net.
Description:
Array can be defined as a collection of similar dataitems.In C#.Net array act as a ReferenceType.We can access the elements of an array using index values.
Syntax:
DataType[] NameOf The Array=new DataType[size];
E.g:
int[] a=new int[5];
(or)
int[] a=new int[]{12,10,1,3,5};
Note:
OutPut:
In this article i would like to publish an article To Find the Largest Number using Arrays in c#.Net.
Description:
Array can be defined as a collection of similar dataitems.In C#.Net array act as a ReferenceType.We can access the elements of an array using index values.
Syntax:
DataType[] NameOf The Array=new DataType[size];
E.g:
int[] a=new int[5];
(or)
int[] a=new int[]{12,10,1,3,5};
Note:
- If we Declare the size of the array it can take exactly that size number of values.
- If we are not declare the size of the array then we can accommodate n number of values.
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace arr
{
class Program
{
static void Main(string[]
args)
{
int[]
a = new int[] {
1, 55, 2, 65, 33 };
Console.WriteLine("Minimum Value is:"+a.Min());
Console.WriteLine("Maximum Value is:" + a.Max());
Console.WriteLine("Thank You For visiting this Blog");
Console.ReadLine();
}
}
}
2 comments:
bruh, where the code at...this is jus using system
He's using System.Linq. Min() and Max() are in the Linq namespace.
Post a Comment