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
When I was married 10 years back my wife was the sixth member of my family. Now I have a baby. Today my father was dead and I had a new baby. Now the average age of my family is the same as that when I was married. Find the age of my father when he was 60.
If Dev walks 30 miles/hr. he reaches 1 hour before and if he walks with a speed of 20 miles/hr. he reach 1 hour late. Find the distance between 2 points and the exact time of reaching destination is 11 am then find the speed with which he walks.
What is the attitude
A lorry starts from Banglore to Mysore at 6.00 A.M,7.00am.8.00 am.....10 pm. Similarly one another starts from Mysore to Banglore at 6.00 am,7.00 am, 8.00 am.....10.00pm. A lorry takes 9 hours to travel from Banglore to Mysore and vice versa. A lorry which has started at 6.00 am will cross how many lorries.
A building with height D shadow upto G. What is the height of a neighbouring building with a shadow of C feet.
In how many rows will 200 Miranda bottles be placed, if 200 Miranda bottles are stacked in such a way that there are 20 bottles in the bottom, 19 in the next row, 18 in the row next and so on?
A cylinder is 6 cms in diameter and 6 cms in height. If spheres of the same size are made from the material obtained, what is the diameter of each sphere?
One clock ringes 7 O'clock in 7 sec.In how many seconds it will ring 10 O'clock.
2 persons are doing part time job in a company(say a and b). THe company is open for all the 7 days of the week.'A' works every second day.'B' works every 3rd day.If 'A'works on 1st june and 'B' works on 2nd june.Find out the date on which both 'A' and 'B' will work together.
x:y=3 and x+y=80 what is the value of y?
Three independent mechanisms A, B and C have been incorporated for power saving in a plant producing respectively 30%, 40% and 10% efficiency. Assuming that they operate independently, what is the net power efficiency achieved
Distance d=rt where r & t are positive and r is constant,as t increases then d_________
There are 19 red balls and one black ball . Ten balls are put in one jar and the remaining 10 are put in another jar. what is the possibility that the black is in the right jar.
All men of this party are republican . mohan is member of this party. mohan is republican is true or false or camn't say?
Financial aptitude