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
If each of the numbers A, B and C are divisible by 2, then A*B*C must be divisible by
In a party man & his wife ,and there r 2 son with their wives, and every son has 4 children in his family .how manyperson r in party.
THERE ARE 3 PILES OF BOOKS ON THE TABLE YOU NEED TO ARRANGE THEM IN THE SELF SUCH THAT 1ST BOOK OF EACH PILE GETS PLACED ON THE SELF,WHAT IS THE POSSIBLE NO OF ARRANGEMENTS
58,27,12,x,2,1. Find x.
4 couples have a party.Depending on the set of statements,find who insulted whom and who is the host of the party.
A person grows cabbage, he uses a larger square this year than previous year and produces cabbages than previous year.what is the no. of cabbages produced this year
How is the father of the man ,who is the brother of the only aunt of my brother related to me?
02: 1/3 of girls , 1/2 of boys go to canteen .What factor and total number of classmates go to canteen?
2 persons start from a pt. and go in opposite directions. After going 3 km they turn left and walk 4 km . how far r they now?
If A=Z, B=Y, C=X, .......... Z=A, Then ZERD = ?
Can you find out what day of the week was January 12, 1979?
Find the next series number : 21, 463, 687, 238, 1134, ----
If a man buys 1 lt of milk for Rs.12 and mixes it with 20% water and sells it for Rs.15, then what is the percentage of gain?
When Raja was born, his father was 32 years older than his brother and his mother was 25 years older than his sister. If Raja’s brother is 6 years older than Raja and his mother is 3 years younger than his father, how old was Raja’s sister when Raja was born?
All people use a bus paid equalty. 40 seats in the bus.Bus charge is Rs. 70.37. How many seats we left unfilled?