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
How to find type of variable?
How big is an int16?
Why does my windows application pop up a console window every time I run it?
Why singleton pattern is used in c#?
What is the use of ispostback in c#?
What is the full form of GAC? Explain its uses?
What are different types of classes in c#?
What are Uses of CLR
Which programming language is best for desktop applications?
Can you prevent a class from being instantiated?
What is windows forms in c#?
What are generations and how are they used by the garbage collector?
What is using keyword in C#?
What is the difference between package and interface?
What is the difference between Object and class adapters?