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
To 15 lts of water containing 20% alcohol, we add 5 lts of pure water. What is % alcohol.
The house is big and lovely but since nobody uses it it is pretty much a white Elephant What does White Elephant mean?
One skirt requires 3.75 yards of cloth. How many skirts you can make from 45 yards?
in a school for a student out of a 100 he got 74 of average for 7 subjects and he got 79 marks in 8th subject. What is the average of all the subjects?
what is the number whose reminder is 2 after dividing 5and also reminder is 4 after deviding 7 and reminder is 6 after deviding 9?
The price of coffee increases by 20%, how much percent consumption of coffee should be reduced by Reema so that the expenditure on coffee remains the same.
A person needs 6 steps to cover a distance of one slab. if he increases his foot length(step length) by 3 inches he needs only 5 steps to cover the slabs length. what is the length of the each slab.
if 2 miles of fence enclose a square plot of 160 acres,how large a square will 4 miles of fence
If m/n = 5/4 , then 2m+n= ?
A boy picks up the phone and asks" who are you?" The voice from the other side answers" I am your mother's mother in law".What is the relation of the boy with the fellow speaking at the other end.
A work is done by the people in 24 min. one of them can do this work a lonely in 40 min. how much time required to do the same work for the second person.
how would you connect 8 dots with 3 lines.
there is a 4 inch cube painted on all sides. this is cut into no of 1 inch cubes. what is the no of cubes which have no pointed sides.
X < 0, Y <> 0 then what is the possibility that the result is always positive?
33 1/3 of 101 + 296 is