Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

f i give input like 1,1,4,5,6,1,2,5,4,1,2, then output
should be like : 1-4, 2-2, 4-2, 5-1, 6-1 which means 1
occurs 4 times, 2 occurs 2 times like so.

Answer Posted / nag

int[] dup = {1,1,4,5,6,1,2,5,4,1,2};
int[] kk = new int[10];
foreach(int k in dup)
{
kk[k] = kk[k] + 1;
}
for (int i = 0; i < 10; i++)
{
if (kk[i] != 0)
Console.Write(i.ToString() + " - " + kk
[i].ToString() + ", ");
}
Console.ReadLine();

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is c# dictionary a hash table?

839


What is readline c#?

835


What is exe file in c#?

847


How does it work?

878


Explain the difference between “system.array.clone()” and “system.array.copyto()” in c#?

884


Why do we need a singleton class?

934


How long has c# been around?

922


What is a scope in c#?

846


What's the difference between the debug class and trace class? Documentation looks the same.

1007


what is difference between destruct or and garbage collection ?

877


Explanation on Generic?

919


Why do we use Design Pattern in C#?

976


Is as keyword in c#?

811


How many kinds of elements an array can have?

871


Is c# code is managed or unmanaged code?

941