frequently asking logical program in interviews for dotnet fresher
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace sorting
{
class Program
{
static void Main(string[] args)
{
ArrayList al = new ArrayList();
Console.WriteLine("adding some numbers");
al.Add(78);
al.Add(45);
al.Add(33);
al.Add(90);
al.Add(40);
al.Add(89);
Console.WriteLine("capacity:{0}", al.Capacity);
Console.WriteLine("count:{0}", al.Count);
Console.WriteLine("content:");
foreach (int i in al)
{
Console.Write(i + " ");
}
Console.WriteLine();
Console.Write("sorted content:");
al.Sort();
foreach (int i in al)
{
Console.Write(i + " ");
}
Console.WriteLine();
Console.ReadKey();
}
}
}
outpuscreen:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace sorting
{
class Program
{
static void Main(string[] args)
{
ArrayList al = new ArrayList();
Console.WriteLine("adding some numbers");
al.Add(78);
al.Add(45);
al.Add(33);
al.Add(90);
al.Add(40);
al.Add(89);
Console.WriteLine("capacity:{0}", al.Capacity);
Console.WriteLine("count:{0}", al.Count);
Console.WriteLine("content:");
foreach (int i in al)
{
Console.Write(i + " ");
}
Console.WriteLine();
Console.Write("sorted content:");
al.Sort();
foreach (int i in al)
{
Console.Write(i + " ");
}
Console.WriteLine();
Console.ReadKey();
}
}
}
outpuscreen:
No comments:
Post a Comment