aaaaaaaaaaaaaaaaa
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
string[] arr = new string[5];
for (int i = 0; i < arr.Length; i++) //Used for input.
{ //If U use int then write like
//'arr[i] = Int32.Parse(Console.ReadLine());' for integers.
arr[i] = Console.ReadLine();
} //for char use like 'arr[i] = char.Parse( Console.ReadLine());'.
for (int j = 0; j < arr.Length; j++) //Used for output.
{
Console.WriteLine(arr[j]);
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int max, min, i;
int[] scores = {39,5,40,100,49,7}; //'scores' is name of Array.
max = scores[0]; //assigning 0 number Element of 'scores' Array to 'max'.
min = scores[0]; //assigning 0 number Element of 'scores' Array to 'min'.
for(i = 0; i < scores.Length; i++) { //loop looping on 'scores' Array.
if (min > scores[i]) { //if 'min' value Gretter then looped number element of Array'scores'
min = scores[i]; //then assign those number Array'scores' Element to 'min'.
}
if (max < scores[i]) { //if 'max' value Less then looped number element of Array'scores'
max = scores[i]; //then assign those number Array'scores' Element to 'max'.
}
}
Console.WriteLine("Minimum Number is: "+ min); //printing 'min' value.
Console.WriteLine("Maximum Number is: "+ max); //printing 'max' value.
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
int i, j, p, swap;
int[] arr = { 6, 22, 33, 1, 4, 3, 54, 2 }; //elements of array assigning to 'arr'array.
for (i = 0; i < arr.Length; i++) //loop looping on 'arr'Array.
{
//loop looping on 'arr'Array U also write 7 on 'arr.Length-1'.
for (j = 0; j < arr.Length - 1; j++)
{
if (arr[j] > arr[j + 1])
{ //if 'arr[j]' gretter then 'arr[j+1]' means 1st element gretter then
swap = arr[j]; //2nd element of 'arr' array then assign 'arr[j]' means 1st element to 'swap'.
arr[j] = arr[j + 1]; //assign 'arr[j+1]' to 'arr[j]' means 2nd element to 1st.
arr[j + 1] = swap; //assign 'swap' value to 'arr[j+1]' means to 2nd element of 'arr' Array.
}
}
}
for (p = 0; p < arr.Length; p++) //loop looping on 'arr' Array.
{
Console.WriteLine(arr[p]); //and printing 'arr' Array Elements.
}
Console.ReadKey();
}
}
}