aaaaaaaaaaaaaaaaa
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{ //'i' is name of array, and data '2,3,1,22,33' assigning to array'i'.
int[] i = { 2, 3, 1, 22, 33 };
for (int a = 0; a < i.Length; a++) //loop start from 0 to less then
//'i'(array) length,and '.Length' is best for length of
//of array in loop.
Console.WriteLine(i[a]); //with the help of 'a' printing
Console.ReadLine();//array'i' elements writing method is
} //(array name 'i' and loop[a]);.
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{ //if U write 'int arr[5];' then it not working.
int[] arr = new int[5]; //giving space 5 for 'arr'array, means for 5 elements.
arr[0] = 10; //this'0' is first space.
arr[1] = 20; //this'1' is second.
arr[2] = 30;
arr[3] = 15;
arr[4] = 5;
for (int i = 0; i < arr.Length; i++)
{
Console.WriteLine(arr[i]);
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string[] week = new string[7];
week[0] = "Sunday";
week[1] = "Monday";
week[2] = "Tuesday";
week[3] = "Wednsday";
week[4] = "Thursday";
week[5] = "Friday";
week[6] = "Saturday";
for (int i = 0; i < week.Length; i++) //one is another loop special
{ //for array, U also use it like 'foreach(string bi in week)'.
Console.WriteLine(week[i]); //if U use foreach then write'(bi);'.
} //in this 'week' array used string bcz used double qotes".
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
int[] arr = { 4, 2, 5, 1, 8 };
int total = 0;
for (int i = 0; i < arr.Length; i++)
total += arr[i]; //it adding all array integers and assinging
Console.WriteLine("The total is: {0}",total); //to total.
Console.ReadKey();
}
}
}