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 / amit kumar mehta

#include<iostream>
using namespace std;

int main() {
int a[] = {1,3,23,11,44,3,23,2,3};
// for ( i = 0; i < 10; ++i) {
// cin >> a[i];
// }
for ( int i = 0; i < 9 ; i++) {
int count = 0;
for (int j = i+1; j < 9; j++) {
if (a[i] == a[j]) {
count++;
}
}
if (count > 0) {
int temp[10];
int rep = 0;
for (int m = 0; m < 10; ++m) {
if (a[i] == temp[m]) {
rep++;
}
}
if (rep <= 0) {
cout << a[i] << " ";
temp [i] = a[i];
}
}
}
return 0;
}

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If Ever + Since = Darwin then D + a + r + w + i + n is ?

3180


There are no of urns &no of balls. If three balls are placed in each urn then 3 balls is left. If 4 balls are placed in each urn then 1 urn is left. What is the total no of balls?

683


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.

678


A Father Has 7 Pennys With Him And 1 Water Melon Is For 1p, 2chickoos For 1p, 3 Grapes Foe 1p. He Has Three Sons. How Can He Share The Fruits Equally?

1459


Imagine 4 persons A,B,C,D.(It is a strength determining game). A found it hard,but could pull 'c' and 'd' to his side. AC and BD pairs on opposite sides found themselves equally balanced. When A and B exchanged their positions to form pairs AD and BC ,BC pair could win and pull AD to their side.Order the 4 persons in Ascending order according to their strengths.

690






A job may be completed in 12 days, working for 8 hours a day if 20 men or 24 women or 40 boys perform the task. If a task four times as big as this is done for 5 hours a day for 12 days, how many men will be required to join 6 women and 2 boys to complete the task?

844


. Select the correct statement a. NEXT SENTENCE and CONTINUE functionally does the same. b. Never can code a DECLARE CURSOR statement in procedure division. c. Edited numeric characters can be included in arithmetic operations. d. The Sub parameters of a DCB parameter are Keyword parameters.

1697


the sum of the present ages of a father and his son is 60 years. Six years ago, father's age was five times the age of the son. After 6 years, son's age will be?

712


There are Brown and Black cows. In five days four black cows and 3 brown cows give as mush as milk that four brown cows and 5 black cows give in four days. If the black cow gives 10 litres of milk per day, how many liters of milk the Brown cow will give in one day? (Numbers are not certain)

853


Imagine a rectangle.Its length=2*width.A square of 1 inch is cut on all corners so that the remaining portion forms a box when folded.the volume of the box is_____ cubic inches.find the original dimensions of the box.

790


The dimensions of a certain box are 48" X 30" X 52". If the size of the box is increased proportionately until the sum of its dimensions equals 156", what will be the increase in the shortest side?

690


how 1000000000 can be written as a product of two factors neither of them containing zeros

728


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?

836


In a storage stall of 5x3x2inch.How many blanks of size 2x1x1inch can be stored..

1481


There r 1200 elephant .some have blue and pink strips.some have pink & green strip. 400 ele. have only pink strip. how many have only blue strip

858