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
a bus started from bus stand at 8.00am and after 30min staying at destination it returned back to the bus stand.the destination is 27 miles from the bus stand the speed of the bus 50percent fast speed at what time it returns to the bus stand.
the average of seven numbers is 2.5 then their product
Could anyone please email the answers to the verizon 2014 aptitude test
In Bangalore, during income tax deduction for a single person, the percentage increased by 3% and for middle house-holders, it decreased by 3%. What can you infer?
A man buys 12 lts of liquid which contains 20% of the liquid and the rest is water. He then mixes it with 10 lts of another mixture with 30% of liquid.What is the % of water in the new mixture?
Find the number WXYZ divisible by 36? i) Let the digits be5, 4,3,6 -not in that order ii) Sum of last two digits is 9 iii) Sum of middle two digits is 7->If one is sufficient then ans as A || if two is sufficient then ans as B || if all are necessary then ans as C || if nothing is needed then
A person went to shop and asked for change for 1.15 paise. But he said that he could not only give change for one rupee but also for 50p, 25p, 10p and 5p. What were the coins he had ?
1992 Feb have 5 Sundays. In which year, the month Feb have 5 Sundays next?
X < 0, Y <> 0 then what is the possibility that the result is always positive?
Three friends divided some bullets equally. After all of them shot 4 bullets the total no.of remaining bullets is equal to that of one has after division. Find the original number divided.
A man, a woman, and a child can do a piece of work in 6 days. Man only can do it in 24 days. Woman can do it in 16 days and in how many days child can do the same work?
sir i need rrb secunderabad goodsguard previous exam papers
The ratio of no. of boys & girls in a school is 3:2 Out of these what % the boys & 25% of girls are scholarship holders. % of students who are not scholarship holders.?
What is your objeective in career ?
A company installed 36 punching machines at the beginning of the year.In the spring they installed 9 additional m/c's and then discontinued 18 in the fall.How many were still installed at the end of the year?