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 |
Plz send me GK question , current affairs..........
WHEN A DB2 IS RUN WITH TSO DATA CAN BE ACCESSED FROM A TSO TERMINAL IN ____________________? a) Foreground b) Batch JOB running in background c)Both a & b d)None of the above
Least no. when divide by 7 gives remainder 6, 6 gives 5, 5 gives 4 and so on ?
6 Answers ABC, AGS, AGS Health, FirstSource, Geometric Software, Marketing, Mylan, TCS,
A single discount equivalent to three successive discounts of 20%, 25% and 10% is a) 55% b) 50% c)48% d)46% plz specify the method... thanks
21 Answers ABC, Arihant, Ashok Leyland, CTS, DELL, Hyundai, Mahindra Comviva, PSTET, SSC, TATA,
A BOX CONTAIN 10 PINK BALLS 5 RED BALLS 6 GREEN BALLS. HOW MANY BALLS SHOULD BE DRAWN SO THAT ATLEAST ONE OF EACH COLOUR IS SELECTED.
consider expresion 'ab' . what happens when 'a' is divided by 'c' & 'b' is multiplied by 'c'.
Some persons decide to raise Rs. 3 lakhs by equal contribution from each of them. If they contributed Rs. 50 extra each, the contribution increased to Rs. 3.25 lakhs. How many persons were there ? (a) 400 (b) 500 (c) 600 (d) 700 (e) None of these
Suhana gets 70% in Maths, 80% in Physics. To get an overall of 75% how much should she get in English.
A hollow cube of size 5 cm is taken, with a thickness of 1 cm. It is made of smaller cubes of size 1 cm. If 4 faces of the outer surface of the cube are painted, totally how many faces of the smaller cubes remain unpainted?
The sum of the two numbers is 45 & difference of 2 numbers is 675. Find the number ?
A person runs 6 ft in 1/4 sec. how much it will run in 10 sec. ans 240
How much is 3/7 larger than 20 percent of 2