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
find the next term 0, 6, 24, 120, -
two persons run a race of 100m. the winner won by (110/11)m and one second in time. find the speed of lsoer in met
A bus started from bus stand at 8.00a m and after 30 min staying at destination, it returned back to the bus stand. The destination is 27 miles from the bus stand. The speed of the bus 50 percent fast speed. At what time it retur4ns to the bus stand
One man brought pen and book from 250 and he sold both at 10% profit on pen and 20% loss on book and finally he gained 40% what is the value of pen
total balls are z, the number of red balls is n and the remaining are blak balls,then the % of black balls equal to ?
A man said to woman " your only brother's son is my wife'sbrother". How is the woman related to the man's wife..
vernanlar : place :: finger print : ?
A Lorry starts from Banglore to Mysore At 6.00 a.m, 7.00 a.m, 8.00 a.m.....10 p.m. Similarly another Lorry on another side starts from Mysore to Banglore at 6.00 a.m, 7.00 a.m, 8.00 a.m.....10.00 p.m. A Lorry takes 9 hours to travel from Banglore to Mysore and vice versa.?
There are 5 red shoes, 4 green shoes. If one draws randomly a shoe what is the probability of getting red shoe is ?
There are 9 balls of equal size and same weight (they look similar) except 1. How may weighs required to find the dissimilar ball using a weighing balance?
How many two digit numbers satisfy the property: the last digit of the square of the two digit number is 8:
1) 1)difference between ip and non ip protocol.
can we write the group-1 exam in telugu
The hour hand lies between 3 and 4. Tthe difference between hour and minute hand is 50 degree.What are the two possible timings?
A person spending out 1/3 for cloths , 1/5 of the remaining for food and 1/4 of the remaining for travelles is left with Rs 100/- . How he had in the beginning ?