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 |
i want some model question papers in banking sector
a family has 4 people. father is 10kgs.mother 10 kgs.daughter 5 kgs,son 5 kgs........the family has to cross a river to reach other side of land ..Assume they should go from A to B....the boat is limited to carry 10 kgs at a time...how will they reach?THERE IS NO SAILOR TO TAKE THEM...
Hello sir, I am Ravindra singh from delhi & I m 25 year old, I have 5 years work experience in sales coordination and my education qualification is B Com, I want to know what should I do after B Com MBA in sales and marketing or supply chain management Or PGDCA , Please suggest me, Thanks Regards Ravindra singh
If Rs20/- is available to pay for typing a research report & typist A produces 42 pages and typist B produces 28 pages. How much should typist A receive?
In 1991, was the number of people in City A three times greater then the number of people in City B?
A husband and wife has a combined age of 91.the husband is now twice as old as his wife was when he was as old as she is now. How old are they? A 60,31 B 71,20 C 52,39 D 56,32
There are three types of tickets available for a concert: orchestra , which cost $12 each; balcony, which cost$9 each: and box, which cost $25 each. There were P orchestra tickets , B balcony tickets, and R box tickets sold for the concert. Which of the following expressions gives the percentage of ticket proceeds due to the sale of orchestra tickets?
Two trains are traveling at 18kmph and are 60 km apart. There is flying in the train. It flies at 80kmph. It flies and hits the second train and then it starts to oscillate between the two trains. At one instance when the two trains colloide it dies. At what distance travel by the fly.
Denominator is 4 greater than numerator if 10 is added to Denominator,the fraction becomes 1/8.what is the fraction.
find the odd one out: 5,6,11,22,42,88,176
WRITE A LEAVE LETTER TO YOUR MANAGER
the difference between two no is 9 and the product of the two is 14 what is the square of their sum?