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

The sum of the series 1 + 1(1+1/n) + 3(1+1/n)2 + ..... is equal to?

736


If the operation,^ is defined by the equation x ^ y = 2x + y,what is the value of a in 2 ^ a = a ^ 3

774


Denominator is 4 greater than numerator if 10 is added to Denominator,the fraction becomes 1/8.what is the fraction.

704


A is driving on a highway when the police fines him for over speeding and exceeding the limit by 10 km/hr.same time B is fined for over speeding by twice the amount by which A exceeded the limit.If he was driving at km/hr what is the speed limit for the road?

1197


A person was fined for exceeding the speed limit by 10 mph.Another person was also fined for exceeding the same speed limit by twice the same. If the second person was travelling at a speed of 35 mph. find the speed limit

914






2. Why would you choose a database system instead of simply storing data in operating system files? Give and explain advantages of using DBMS.

1013


in 80 coins one coin is counterfiet what is minimum number of weighings to find out counterfiet coin

830


sum of 5 consecutive numbers is 35. how many of the numbers are prime:

694


A father F has 5 sons, p,q,r,s,t. Not necessarily in this order. Two are of same age. The eldest and youngest cannot be twins. T is elder to r and younger to q and s has three older brothers. who is the oldest and youngest?

738


in how many ways can a lock be opened if that lock has three digit number lock if the last digit is 9 and sum of the first two digits is less than or equal to the last digit. numbers are from 0-9

829


Find the correct meaning of the following phrase: To be in the air

735


In a car wheel, two spokes cover 15 degree. Then for the entire car,how many spokes are there?

755


Ram starts from A walking 2 km North and turns right and walks 4 km and turns right again and walks 4 km and turns right again and walks 4 km and meets Radha at Bwalking in the opposite direction to Ram . Which direction does Ram walk after the first turn?

1050


A mother is 30 years older than her daughter however she will be only thrice as old as the daughter after 5 years. What is mother’s present age ?

671


Lucia is a wonderful grandmother and her age is between 50 and 70. Each of her sons have as many sons as they have brothers. Their combined ages give Lucia's present age.what is the age?

891