using System;
using System.Linq;
namespace LearnCS
{
class Program
{
static void Main(string[] args)
{
string[] pLanguages = { "Perl", "Python", "Java", "JS", "C++", "C" };
int[] numbers = { 1, 34, 25, 23442, 56, 56, 56, 100 };
Console.WriteLine("Position 0: " + pLanguages[0]);
Console.WriteLine("Position 5: " + pLanguages[5]);
pLanguages[0] = "Prolog";
pLanguages[1] = "Lisp";
foreach (string i in pLanguages) {
Console.WriteLine(i);
}
//Length of Array
Console.WriteLine("Length of Array : " + pLanguages.Length);
//For Loop
for (int x = 0; x < pLanguages.Length; x++) {
Console.WriteLine("Index of: " + x + " Value: " + pLanguages[x]);
}
Array.Sort(numbers);
foreach (int i in numbers)
{
Console.WriteLine(i);
}
//System.Linq Namespace
Console.WriteLine("Sum: " + numbers.Sum());
Console.WriteLine("Max: " + numbers.Max());
Console.WriteLine("Min: " + numbers.Min());
Console.ReadLine();
}
}
}
No comments:
Post a Comment