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 am first every thing. I end of all trouble. I Alway come in time. I alway end a dialogue. I alway in u r Dream.
The price of a candy bar is $1.00. The price of a ten pack of the same candy bar is $7.40. The ten pack of candy bars is what percentage cheaper then purchasing ten candy bars individually?
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,
Alok and Bhanu play the following min-max game. Given the expression N = 9 + X + Y – Z where X, Y and Z are variables representing single digits (0 to 9), Alok would like to maximize N while Bhanu would like to minimize it. Towards this end, Alok chooses a single digit number and Bhanu substitutes this for a variable of her choice (X, Y or Z). Alok then chooses the next value and Bhanu, the variable to substitute the value. Finally Alok proposes the value for the remaining variable. Assuming both play to their optimal strategies, the value of N at the end of the game would be
A sales person multiplied a number and get the answer is 3, instead of that number divided by 3. what is the answer he actually has to get ? (1/3). 7. A ship started from port and moving with I mph and another ship started from L and moving with H mph. At which place these two ships meet ?
hi dis s krishna frm hyd.am dng rtech 3rd yr in IT branch. so am interested in group 1 exams,is this right time to start preparation.plz answer to Q!
0 Answers Godrej, State Bank Of India SBI,
c=a/b ; a-1=c What is the relation between a&b
0.23 + 0.02323 + 0.002323.... == ???
Raju climbs upstairs a running escalator at 45km/hr and climbs downstairs at 95 km/hr. What is the speed of Raju when escalator is not moving?
A Farmer owns a square land of 15 m each side with a pole in one of the corners to which he tied his cow with a rope whose length is about 10 m. What is the area available for the cow to graze. (Assume pi = 3)
Nationalism of Dalai Lama?
A clock gives 4 ticks consequetively. After days it has become defective & gives only 2 ticks. What is the probability that clock produces 3 ticks consequetively?
3 Answers SK Industries, TATA, TCS,