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

There are 9 balls of these one is defective. Find the minimum no. of chances of finding the defective one.

862


total balls are z, the number of red balls is n and the remaining are blak balls,then the % of black balls equal to ?

697


Complete the sequence A, E ,I ,M ,Q ,U , _ , _?

683


Find odd one cat,dog,rabbit,hamster,elk.

897


how to get the system time dynamically in orcle

1643






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

730


Find the value of (1.99)2

924


in a city, there are 100 buildings numbered by corporation between 0-100, how many twos are shown in door,

678


There six red shoes & 4 green shoes .If two of the shoes are drawn.What is the probability of getting two red shoes.

793


A batsman scores 23 runs and increases his average from 15 to 16. Find the runs to be made if he wants top Inc the average to 18 in the same match.

759


Supposing a clock takes 7 seconds to strike 7. How mlong will it take to strike 10?

888


There are five thieves, each loot a bakery one after the other such that the first one takes 1/2 of the total no. of the breads plus 1/2 of a bread. Similarly 2nd, 3rd,4th and 5fth also did the same. After the fifth one no. of breads remained are 3. Initially how many breads were there?

899


there is a safe with a 5 digit No. 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.

836


Robert invested rupees 8000 in a fixed deposit scheme for 2 years at compound interest of 5 p.c per annum. Calculate and choose from the below mentioned option, how much amount will Robert get from the fixed deposit on maturity?

746


Two trains are traveling in 60 kmph on same trace, towards each other. When the distance between them is 18 km, a fly is going to start, flying between them in 80 kmph speed. Find the traveling path distance of the fly upto when it is going to crush by the 2 trains?

694