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
What .exe means?
How do you inherit a class into other class in c#?
What are the advantages of constructor?
What are primitive data types in c#?
Is c# pass by value?
What is jit (just in time)?
When would you use generics in your code c#?
Is java better than c#?
What is escape character in c#?
How do you implement thread synchronization in c#?
Explain about Serialize and MarshalByRef?
What is xor operation?
Which config file has all the supported channels/protocol?
What are floating point numbers?
Write a syntax for writing a event delegate.