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

Give examples for reference types?

1002


What are handlers in c#?

964


i want o/p 011242110 in c# code.

2076


What is dll file in c#?

981


What is bit in c#?

983


What is returned if you pass the value 12.34 to the parsefloat () function?

979


What is delegates and events?

949


Structs are not reference types. Can structs have constructors?

989


How to Install uninstall assemblies into GAC?

950


Is a structure a class?

952


Explain how can you clean up objects holding resources from within the code?

937


Explain how can I get around scope problems in a try/catch?

923


Can c# inherit multiple classes?

966


What is a static in c#?

928


Is it possible to have a static indexer in c#?

990