-
Notifications
You must be signed in to change notification settings - Fork 0
/
arrays.cs
41 lines (31 loc) · 1 KB
/
arrays.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
namespace Arrays
{
class Program
{
static void Main(string[] args)
{
int[] array = new int[] { 1, 9, 4, 5, 6, 9, 2 };
// Dispalys value of first element of array
int y = array.First();
{
Console.WriteLine($"Value of first element in array is {y}");
}
// Displays in console value of last element of array
int i = array.Last();
{
Console.WriteLine($"Value of last element in array is {i}");
}
// Displays value of Max element in array
int p = array.Max();
{
Console.WriteLine($"Value of maximum element in array is {p}");
}
// Displays sum of all elements in array
int x = array.Sum();
{
Console.WriteLine($"Sum of all elements in array is {x}");
}
}
}
}