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 do you escape in c#?
Which of the following API is used to hide a window?
Why is it efficient to use System.string under System.Text.StringBuilder ?
What is .net console?
From which base class do all Web Forms inherit from?
What is c sharp language?
What are the 4 pillars of any object oriented programming language?
What is boxing? Explain its functionality?
What is dictionary collection in c#?
Can you have an array of arrays?
What is reflection c#?
What is Wrapper class in dot net?
How do I edit a dll file?
Expalin the way you implement inheritance by using VB.NET/C#?
What is the relation between classes and objects?