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
find then next series number 5,6,7,8,10,11,14,..?
Hi Guys. I am an Instrumentation and Control Engineer(ICE) and have filled various PSU entrance exam forms. I wanted to know if anyone of you out there had any material for the preparation of the same. Any sort of material will be greatly appreciated. Be it previous year questions (Aptitude, GK or Technical) , study material or links to websites which do have this material. PSUs that I am going to appear in are HPCL, SAIL, ECIL and finally Gate. Any suggestions and advice is greatly welcomed. My E-Mail ID is kris_sreekanth86@yahoo.co.in
there are two categories of persons in ratio a:b = 2:3. A type earns 2.5 dollars/hr and b type 1 dollar/hr total money earned by both is 24dollars. Then what is the total number of persons
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.
hai am Deepak here i have my exam on 3rd jan 2010 for the post of officers job in karnataka bank so kindly plz send me model papers . thank u
A family has several children. Each boy in this family has as many sisters as brothers but each girl has twice as many brothers as sisters. How many brothers and sisters are there?
A triangle has sides of lengths 10, 24 and k. k is a positive integer. The number of values of k for which this triangle has three acute angles is
if a=2, b=3, c=6 Find the value of c/(a+b)-(a+b)/c
A batsman scores 23 runs and increases his average from 15 to 16. Find the runs to be made if he wants top Inc the average to 18 in the same match.
B is 20 miles east of A. D is 30 miles east of C. E is 10 miles north of D. C is 20 miles north of B. How far E is from A?
1,40,00,000 pencils are put up straight. all the pencils are of length range 3 to 6 inches. 80% of the pencils have average of five inches. so the find out the total length spanned by the penciles.
I HAVE APPEARED FOR ALLAHABAD BANK ON 21-02-10, I WANT TO KNOW THE SECTIONAL CUT OFF'S FOR CATEGORY.
The cost of one pencil, two pens and four erasers is Rs.22 while the cost of five pencils, four pens and two erasers is Rs.32.How much will three pencils, three pens and three erasers cost?
If a clock takes 7seconds to strike 7, how long will the same clock take to strike 10?
4 cows are there at the four corners of a square. if the radius of the rope is 1 and lenth of one side of the square is 14, find the area along the square which the cow cannot gaze.