Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



Input an array and then print the repeating characters?? Example: Input:1,3,23,11,44,3,23,2,3. Ou..

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

Input an array and then print the repeating characters?? Example: Input:1,3,23,11,44,3,23,2,3. Ou..

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

Input an array and then print the repeating characters?? Example: Input:1,3,23,11,44,3,23,2,3. Ou..

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

Input an array and then print the repeating characters?? Example: Input:1,3,23,11,44,3,23,2,3. Ou..

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

Input an array and then print the repeating characters?? Example: Input:1,3,23,11,44,3,23,2,3. Ou..

Answer / rahulkashyaprajput

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

Post New Answer

More General Aptitude Interview Questions

there is number X in decimal represntation whose last digit is not 0. if digits of X are reversed then we obtain new number say Y. both X and Y are divisible by 7. then find all such X from 10 to 1000.

5 Answers   CAT,


8 man work for 6 days to complete a work. How many men are required to complete same work in 1/2 day.

5 Answers   Citicorp, COSL, Wipro,


2020201-565656=?

0 Answers   Accenture,


In a cricket match, two batsman playing on 94 runs each and they need 7 more runs to win in last 3 balls. at last they win the match and both batsman scored 100 runs not out. how it is possible that both batsman scored 100 run each being not out?

14 Answers   Infosys,


What is the angle between the two hands of the clock when it shows 10:10?

0 Answers   CGI,


In a fraction, if 1 is added to both the numerator at the denominator, the fraction becomes 1/2. If numerator is subtracted from the denominator, the fraction becomes 3/4. Find the fraction.

0 Answers   Accenture,


Want to get some material for apptitud e for banking preparation

0 Answers  


Cities A and B presently have populations of 70,000 and 60,000, respectively. City A grows at the rate 4% per year, and B grows at the rate of 5% per year. After how much time will city B have a larger population than city A? Answer in number of years to 2 decimal places.

2 Answers  


Tell me something About Yourself..? In this Ques. How will I start and where I have to End..

4 Answers   HP,


hi... i am kanchana presently i have applyed for the indian bank clerk examination.. Pls tell me about the clerk interview what type of question they will ask..kindly send me detailes under signed email id: kanchana_kks@yahoo.com

1 Answers   BSRB,


What is bull and bear market

2 Answers   eClerx,


Pointing towards a girl in the picture, Sunita said, ?She is the mother of Renu whose father is my son?. How Sunita is related to that girl in the picture? (1) Mother (2) Aunt (3) Cousin (4) Data inadequate (5) None of these

16 Answers  


Categories