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
A person has his own coach&whenever he goes to railway station he takes his coach.One day he was supposed to reach the railway station at 5 O'clock.But he finished his work early and reached at 3 O'clock. Then he rung up his residence and asked to send the coach immediately. He came to know that the coach has left just now to the railway station.He thought that the coach has left just now to the railway station.He thought that he should not waste his time and started moving towards his residence at the speed of 3min/hr.On the way,he gets the coach and reaches home at 6 o'clock.How far is his residence from railway station.
If x,y,z are three consecutive natural numbers, which of the following numbers should be x+y+z
In a typical motor cycle rally, every motor cycle has to reach a speed of 20 m/min within a minute and it increase its speed by 20 m/min and the sum was 1600 m/min. Four minutes later, a new motor cyclist started running in the race. After another two minutes, the motor cyclist with the speed of 400 m/min stopped due to injuries and again two new motor cyclist started running in the race. What is the current average speed?
Three years ago my uncle offered me a used keyboard for Rs. 1024. A year later he offered me the same for Rs. 640 and last year he wanted Rs. 400 and now he is willing to sell it to me for Rs. 250. But I have decided to buy it when he reduces the price next time. If he is constantly reducing its price, at what price will he offer the keyboard to me next?
what is the angle between two hands of a clock when time is 8-30
In a show, ticket numbers from 101 to 350 are made to sit consecutively. What is the probability that the number of the ticket, selected at random, will be a hundredth digit of 2?
The cost of 16 articles is equal to sell price of 12 articles. The gain percent is ?
In a digital circuit which was to implement (A B) + (A)XOR(B), the designer implements (A B) (A)XOR(B) What is the probability of error in it ?
A sales person multiplied by a number and get the answer 3. Instead of that number divided by 3. What is the answer she actually has to get. (1/3) * 1 *3 =3 so the no= 1 divided by three.
A sum of money becomes 2.5 times itself at 12.5% simple interest p.a. What should be the period of investment to get this much return?
If D is adjacent to F then who is adjacent to C?
there is a matrix N x N .Its elements consist of either value =1 or value=0. If there is a any zero in the row, then the output matrix should have all zeroes in that row. If there is a single zero in any column then that column should have all zeroes n the output matrix. write the function to perform these operations. i want a solution in c/c++ language
Find the next number in the series. 1, 0.5, 0.25, 0.125
Find the next series: SE QU EN TI ?
Ms. Neelam deposits an amount of Rs. 16420 at simple interest and obtained 25451 at the end of 5 years. What was the rate of interest per year?