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

one fast typist type some matter in 2hr and another slow typist type the same matter in 3hr. if both do combinely in how much time they will finish.

707


A person grows cabbage, he uses a larger square this year than previous year and produces cabbages than previous year.what is the no. of cabbages produced this year

712


halley is clarks father& arthur is halleys father.after some years when halleys age is equal to arthurs age,halleys age becomes 5 times of clarks present age.clarks age then is 8 times his fathers present age. sum of arthur & halleys age is 100 find clarks present age

698


How many mod 3 counters are required to construct mod 9 counter.

704


The main line train starts at 5.00AM and the harbor line train starts at 5.02AM. Each train has the frequency of 10 minutes.If a guy goes in the morning at a random time what is the probability of he getting main line train?

905






If POINT + ZERO = ENERGY, then E + N + E + R + G + Y = ?

2703


36:4 :: 9: ?

764


+ means * and * means / and / means % what is the value of these question 2+3*5/7 it was two question of these type.

694


Using the digits 1,5,2,8 four digit numbers are formed and the sum of all possible such numbers.

776


Radha,Geeta&Revathi went for a picnic.After a few days they forgot the date,day and month on which they went to picnic.Radha said that it was on Thursday,May 8 and Geeta said that it was Thursday May 10.Revathi said Friday Jun 8.Now one of them told all things wrongly,others one thing wrong and the last two things wrongly.If April 1st is tuesday what is the right day,date and month?

871


Daal is now being sold at Rs. 20 a kg. During last month its rate was Rs. 16 per kg. By how much percent should a family reduce its consumption so as to keep the expenditure fixed?

921


194 base 10 = ____ base 5

841


Two coins one with HEAD IN BOTH SIDES and the other coin HEAD IN ONE SIDE AND TAIL IN THE OTHER SIDE is in a box,a coin is taken at random and FOUND HEAD IN ONE SIDE .what is the probability that THE OTHER SIDE IS HEAD?

732


A clock showing 6 o'clock takes 30 secs to strike 6 times.How long will it take to strike 12 at midnight?

1089


A man collects cigarette stubs and makes one full cigarette with every 8 stubs.If he gets 64 stubs how many full cigarettes can he smoke.

1268