Input an array and then print the repeating characters??
Example:
Input:1,3,23,11,44,3,23,2,3.
Output:3,23
plz help me.... i want a code of it. In C language.

Answer Posted / ankit dhanna

#include<iostream.h>
#include<conio.h>
void main()
{
int a[8],i,j,k,temp[8];
k=0;
cout<<"enter 8 elements "<<endl;
for(i=0;i<8;i++)
{
cin>>a[i];
}

for(i=0;i<8;i++)
{
for(j=0;j<8;j++)
{
if((a[i]==a[j])&&(i!=j))
{

temp[k]=a[i];
k++;
}

}
}

for(i=0;i<k/2;i++)
{
cout<<"repeated element "<<temp[i];
}

getch();
}

Is This Answer Correct ?    16 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

All people use a bus paid equalty. 40 seats in the bus.Bus charge is Rs. 70.37. How many seats we left unfilled?

803


An orange glass has orange juice and white glass has apple juice both of equal volumes. 50ml of the orange juice is taken and poured into the apple juice. 50ml from the white glass is poured into the orange glass. Of the two quantities, the amount of apple juice in the orange glass and the amount of orange juice in the white glass, which one is greater and by how much?

989


A lorry starts from Banglore to Mysore at 6.00 A.M,7.00am.8.00 am.....10 pm. Similarly one another starts from Mysore to Banglore at 6.00 am,7.00 am, 8.00 am.....10.00pm. A lorry takes 9 hours to travel from Banglore to Mysore and vice versa. A lorry which has started at 6.00 am will cross how many lorries.

1545


There N stations on a railroad. After adding x stations 46 additional tickets have to be printed. Find N and X.

728


Sir iam going to write exam for the post of Officers under training in APSRTC. Please send me the model papers to my mail ganjiramji@gmail.com

1704






A and b can do a piece of work in 15 and 10 days. A and b work on it for sometime and then a leaves b completes the job in 5 days. For how long did a work.

798


There is square of side 6 cm .A circle is inscribed inside the square Find the ratio of area of circle to the squqre .

728


There are following denominations of money: 1, 2, 5, 10, 20, 50, and 100 paise. Alex has as twice mony as David, who has as twice as Bindya, who again has as twice money as Charles. Each has two coins in hand. Which coins Bindya has?

779


How many five digit numbers are there such that two left most digits are even and remaining are odd?

842


X and Y are partners in a business. X invests 300 for 12 months and Y invested 600 for 6 months. If they gain a profit of 700 at the end of one year, what is X's share?

1369


What number should be added to or subtracted from each term of the ratio 17 : 24 so that it becomes equal to 1 : 2.

706


Complete the series: 5, 20, 24, 6, 2, 8, ?

1013


if 2 miles of fence enclose a square plot of 160 acres,how large a square will 4 miles of fence

5919


why we will appoint you.

1800


How is the father of the man ,who is the brother of the only aunt of my brother related to me?

720