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 / kirubasankar

#include<iostream.h>
#include<conio.h>
void main()
{
int i,j;
int a[20],t;
clrscr();
for(i=0;i<5;i++)
{
cin>>a[i];
}
for(i=0;i<5;i++)
{
for(j=i+1;j<=5;j++)
{
if(a[i]>a[j])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
cout<<a[i];
}

getch();
}

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is entity framework c#?

540


Can datetime be null c#?

564


What is lazy in c#?

587


How to add a readonly property in c#.net

584


Will the following code compile?

631






What the different phase/steps of acquiring a proxy object in webservice?

554


Explain the difference between and xml documentation tag?

581


Does google use c#?

604


What is toint32 c#?

710


What is ienumerable t in c#?

557


Is for loop faster than foreach?

611


What do constructors do in c#?

581


What is the difference between delegates and events in c#?

508


What are the string functions in c#?

606


Where do I put dll files?

642