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
List the two important objects of ado.net and also list the namespaces that are commonly used in ado.net to aid in connection to a database.
Why objects are stored in heap in c#?
What is “using” statement in c#?
How many bytes is a char c#?
What is the difference between int and int in c#?
What's the implicit name of the parameter that gets passed into the set method/property of a class?
What is array and types of array in c#?
What is delegate in c# interview questions?
What is a .aspx file?
Is friend a constructor?
Are structs faster than classes?
What is difference between class and abstract class in c#?
How do I run managed code in a process?
State whether it is true to test a Web service you must create a windows application or Web application to consume this service or not?
What is the lock statement in c#?