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
There are 3 societies A,B,C having some tractors each. A Gives B and C as many tractors as they already have. After some days B gives A and C as many tractors as they have. After some days C gives A and B as many tractors as they have. Finally each has 24 tractors.what is the original No.of tractors each had in the beginning?
Find the product of the prime numbers between 1-20
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?
What annual payment will discharge a debt of rs. 6,450 Due in 4 years at 5% per annum simple interest?
A cloth merchant claims to sell is material at cost price but uses a scale which reads 1 meter for every 95 centimeter. Find the gain percent?
How do you convince the retailer to sell you product?
Find the next letter in the series Q,W,E,R,T,--
The cycle has following specifications: The rear derailer is on the 14 tooth gear and the front derailer is on the 52 tooth gear. The rear gear has 14 teeth. The diameter of the rear wheel is 27". If a cyclist pedals at 75 revolutions per minute, then what will be the speed achieved?
in a question ,last part has, the ages of two people has the ratio of 6:6 and by adding the numbers we get 44, after how many years the ratio would be 8:7?
A ship went on a voyage.After it had travelled 180 miles a plane statrted with 10 times the speed of the ship. An army 50 miles long marches at a constant rate. A courier standing at the rear moves forward and delivers the message to the first person and then turns back and reaches the rear of the army as the army completes 50 miles. Find the distance travelled by the courier.
There is a certain four digit number whose fourth digit is twise the first digit. Third digit is three more than second digit. Sum of the first and fourth digits twise the third number. What was that number ?
Yadi a or b kisi kam ko 12 din me pura krte h tatha b or c usi kam ko 16 din me pura kr sakte h , pahle a is kam ko 5 dino tak karta h fir b 7 dino tk kam ko karta h sesh kam c 13 dino me samapt kr deta h to c akele kam ko kitne dino me pura krega?
epaulette : shoulder :: tiara :
There are 5 red shoes, 4 green shoes. If one drasw randomly a shoe what is the probability of getting redshoe is
In a queue, a man is standing at the position 10th from the front and 15th from behind. How many persons are standing in the queue?