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 |
consider expresion 'ab' . what happens when 'a' is divided by 'c' & 'b' is multiplied by 'c'.
5 Answers College School Exams Tests, Wipro,
I am at my paying guest accommodation if I am not in the office. a) I am at my paying guest accommodation. b) I am at my office. c) I am not at paying guest accommodation. d) I am not at my office. A) cb B) ad C) cd D) None of the options
Out of 10 white, 9 black and 7 red balls, in how many ways can we select one or more balls please with solution.
X2 – (A-3)X +(A+3) = 0 for what value of A the sum of square of roots will be least ?
In base 10 representation for a rupee 100 paise,then base 8 representation what is rupee value?
i attended sbi clerical interview on28/04/10.on 20/08/10 i called sbi headoffice 022-22024619 they said tht final result will be declared after 2 months.i also had another no 022-22826300.if anybody are interested cal those no's.my mobile no is 9010347790(udamsingh)
0 Answers State Bank Of India SBI, TCS,
interview question : what is equity ? or what is Capital Market? What is Derivatives? Excel question : Shortcut keys, pivot tables, vlookup and hlookup, autofilter, sorting etc
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?
A class consists of 100 students, 25 of them are girls and 75 boys; 20 of them are rich and remaining poor; 40 of them are fair complexioned. The probability of selecting a fair complexioned rich girl is
A can do a work in 8 days, B can do a work in 7 days, C can do a work in 6 days. A works on the first day, B works on the second day and C on the third day rely. that is they work on alternate days. When will they finish the work.(which day will they finish the work) (7+7/168)
Find the next letter in the series O,T,T,F,F,S,S--
Hello friends, please send me hdfc bank interview aptitude question papers for preparing interview.