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.
Answers were Sorted based on User's Feedback
Answer / amit rawat
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int ar[8]={2,3,4,5,2,9,8,7};
for(int i=0;i<8;i++)
{for(int j=i+1;j<8;j++)
{if(ar[i]==ar[j])
{cout<<"\n Repeated no is";cout<<ar[i];
}
}
}
getch();
}
| Is This Answer Correct ? | 33 Yes | 14 No |
Answer / 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 |
Answer / ankit dhanna
#include<iostream.h>
#include<conio.h>
void main()
{
int a[8],i,j,k,temp[8];
k=0;
cout<<"enter 8 elements "<<endl;
for(i=0;i<8;i++)
{
cin>>a[i];
}
for(i=0;i<8;i++)
{
for(j=0;j<8;j++)
{
if((a[i]==a[j])&&(i!=j))
{
temp[k]=a[i];
k++;
}
}
}
for(i=0;i<k/2;i++)
{
cout<<"repeated element "<<temp[i];
}
getch();
}
| Is This Answer Correct ? | 16 Yes | 15 No |
Answer / saurabh singh
n = [int(x) for x in input().split()]
for i in range(len(n)):
for j in range(i+1, len(n)):
if n[i] == n[j]:
print(n[i])
#saurabhsingh
| Is This Answer Correct ? | 0 Yes | 1 No |
package repeatingno;
import java .io.*;
public class Reap
{
public static void main(String args[])throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int no,max=0,n,count=0;
System.out.println("enter no of elements");
no=Integer.parseInt(br.readLine());
int ar[] = new int[no];
System.out.println("enter elements");
for(int i=0;i<no;i++)
ar[i]=Integer.parseInt(br.readLine());
for(int i=0;i<no;i++)
{
if(ar[i]>max)
{
max=ar[i];
}
}
System.out.println("repeated elements are");
for(int i=0;i<=max;i++)
{ for(int j=0;j<no;j++)
{
if(i==ar[j])
count++;
}
if(count>1)
System.out.print(i+" ");
count=0;
}
}
}
| Is This Answer Correct ? | 0 Yes | 2 No |
Side of rhombus is 5cm and sum of lengths of diagonals is 12cm. what is the area of rhombus?
please Send K.V.B Bank Clerical Exams Previous Or Model Question Papers. My Email Id: rajeshbabumfm@yahoo.com
2 Answers Karur Vysya Bank KVB,
A bus started from bus stand at 8.00a m and after 30 min staying at destination, it returned back to the bus stand. The destination is 27 miles from the bus stand. The speed of the bus 50 percent fast speed. At what time it retur4ns to the bus stand
find the smallest no in gp whose sum is 38 and product is 1728 a. 12 b. 20 c. 8 d. none of these
There are 80 coins, among them one coin weighs less compared to other. You are given a physical balance to weigh. In how many wieghings the odd coin can be found.
The average salary of Ram, Shyam and Sundar is 95 Rs. per week. If Ram earns Rs.115 and Shyam earns Rs.65.What is the salary of Sundar.
The owner of a hobby store needed to calculate the percentage of customers who purchase wood glue. Upon completing his survey, he noticed that 60% of the people that entered his store purchased an item. Of those customers, 15 percent purchased wood glue. What percent of the people that entered the store purchased wood glue?
If a person walks at 4/5th of his usual spee he reaches 40min late. If he walks athis usual speed how much time does he travels.
7 Answers BEML, Geometric Software,
Sum of money at compound interest amounts of thrice itself in 3 years. In how many years will it take 9 times itself.
How many meaningful English word can be formed by using the second, the fifth, the seventh and the tenth letters of the word APPROPRIATION, each only once, but in different sequence ? (a) One (b) Two (c) Three (d) None of these (e) More than three
In 1978, a kg of paper was sold at Rs25/. If the paper rate increases at 1.5% more than the inflation rate which is 6.5% a year, then what will be the cost of a kg of paper after 2 years?
It cost a college Rs.0.70 a copy to produce a Programme for the homecoming football game. If Rs.15,000/- was received for advertisements in the programme, how many copies at Rs.0.50 a copy must be sold to make a profit of Rs.8000/- ?
5 Answers IBM, L&T, TCS, Wipro,