using System;
class Program
{
static void Main(string[] args)
{
//Declaration of Array
int[] score;
//initialization of Array
score = new int[5];
score[0] = 10;
score[1] = 20;
score[2] = 5;
score[3] = 50;
score[4] = 40;
// Displaying an Array
for (int j = 0; j < 5; j++)
{
Console.WriteLine(score[j]);
}
//For Each Loop
foreach (int k in score)
{
Console.WriteLine(k);
}
Console.ReadLine();
}
}
class Program
{
static void Main(string[] args)
{
//Declaration of Array
int[] score;
//initialization of Array
score = new int[5];
score[0] = 10;
score[1] = 20;
score[2] = 5;
score[3] = 50;
score[4] = 40;
// Displaying an Array
for (int j = 0; j < 5; j++)
{
Console.WriteLine(score[j]);
}
//For Each Loop
foreach (int k in score)
{
Console.WriteLine(k);
}
Console.ReadLine();
}
}
No comments:
Post a Comment