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

My name is deepshikha .if any one have quentiles apptitude question paper please mail me on diffmail172@gmail.com.

3142


An apple seller is having some apples. He is selling half of the apple what he has plus half the apple to the first customer. In the same way he sells the remaining apple to 7 customers. After selling to 7 customers, he has no apples with him.

760


A Father Has 7 Pennys With Him And 1 Water Melon Is For 1p, 2chickoos For 1p, 3 Grapes Foe 1p. He Has Three Sons. How Can He Share The Fruits Equally?

1434


B is 20 miles east of A. D is 30 miles east of C. E is 10 miles north of D. C is 20 miles north of B. How far E is from A?

828


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

1240






A cubical rectangular bar has the dimensions with the ratio 5 : 4 : 3. Its volume is 7500. What is the surface area of the bar?

1260


Time and speed time and work boat and streams

932


Find the Series number: 2,5,9,19,37,..

815


Find the next number in the series 1, 3 ,7 ,13 ,21 ,31?

711


02: 1/3 of girls , 1/2 of boys go to canteen .What factor and total number of classmates go to canteen?

990


During a given week A programmer spends 1/4 of his time preparing flow chart, 3/8 of his time coding and the rest of the time in debugging the programs. If he works 48 hours during the week , how many hours did he spend debugging the program.

789


A can do a piece of work in 30 days, which B can do in 20 days. Both started the work but A left 5 days before the completion of the work. It took how many days to complete the work?

713


In a fraction, if 1 is added to both the numerator at the denominator, the fraction becomes 1/2. If numerator subtracted from the denominator, the fraction becomes 3/4. Find the fraction.

711


what is diff b//w the singly reinforced beam,doubly reinforced beam?

1337


There is a safe with a 5 digit number as the key. The 4th digit is 4 greater than second digit, while 3rd digit is 3 less than 2nd digit. The 1st digit is thrice the last digit. There are 3 pairs whose sum is 11. Find the number.

684