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 / rahulkashyaprajput

package repeatingno;
import java .io.*;
public class Reap
{
public static void main(String args[])throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int no,max=0,n,count=0;
System.out.println("enter no of elements");
no=Integer.parseInt(br.readLine());
int ar[] = new int[no];
System.out.println("enter elements");
for(int i=0;i<no;i++)
ar[i]=Integer.parseInt(br.readLine());
for(int i=0;i<no;i++)
{
if(ar[i]>max)
{
max=ar[i];
}

}
System.out.println("repeated elements are");
for(int i=0;i<=max;i++)
{ for(int j=0;j<no;j++)
{
if(i==ar[j])
count++;
}

if(count>1)
System.out.print(i+" ");
count=0;
}

}
}

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If VXUPLVH is written as SURMISE, what is SHDVD?

1763


sqrt(0.16)+cubic root(0.027) equals

902


The average of 13 papers is 40. The average of the first 7 papers is 42 and of the last seven papers is 35. Find the marks obtained in the 7th paper?

1175


2. Masi specialises __ plesent ,well balanced wines into, about ,in, with 3. By the time I arrived __ the pub she all ready left in, on , at, into 4. erbiage the act of doing something the use many words witout nessecity a vegitable non of the above

6482


If x,y,z are chosen frm -3,1/2,2 what is the largest value of (x/y)*z*z

966


The price of Machine D equals the sum of the prices of machine A, B and C whose price are in the ratio 2:3:4 respectively. If weights of A, B, C and D varies as square of its individual price and difference of weight of D and A, B and C together is 9880 kg. Then what is the weight of D?

1256


(7*7=49)(4*9=36)(3*6=18) (1*8=8)

1028


pls help about karnataka bank officers exam paper and guide me about pattern pls total time given and different sub they asked in exam?

2683


How Can A Cake(circular) Be Cut Into 8 Pieces By Making Just 3 Cuts?

881


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.

1058


A certain street has 500 buildings. A sign-maker is contracted to number the houses from 1 to 500. How many zeroes will he need?

1537


In a soap company a soap is manufactured with 11 parts. For making one soap you will get 1 part as scrap. At the end of the day u have 251 such scraps. From that how many soaps can be manufactured?

1106


The equivalent compound ratio of 5:6::7:10::6:5

979


How long will a train 100m long travelling at 72kmph take to overtake another train 200m long travelling at 54kmph

1228


A person walking 5/6 of his usual rate is 40 minutes late. What is his usual time?

1203