answersLogoWhite

0

Java program to identify duplicates in a sequence of ten intgers?

Updated: 8/17/2019
User Avatar

Chuckster1

Lvl 1
14y ago

Best Answer

Compare each number with all the previous numbers. For example:

boolean duplicateExists = false;
int duplicateNumber;

for (int i = 0; i < 10; i++)
for (int j = 0; j < i; j++)
if (myNumbers[i] == myNumbers[j])
{
duplicateExists = true;
duplicateNumber = myNumbers[i];

}



Compare each number with all the previous numbers. For example:

boolean duplicateExists = false;
int duplicateNumber;

for (int i = 0; i < 10; i++)
for (int j = 0; j < i; j++)
if (myNumbers[i] == myNumbers[j])
{
duplicateExists = true;
duplicateNumber = myNumbers[i];

}



Compare each number with all the previous numbers. For example:

boolean duplicateExists = false;
int duplicateNumber;

for (int i = 0; i < 10; i++)
for (int j = 0; j < i; j++)
if (myNumbers[i] == myNumbers[j])
{
duplicateExists = true;
duplicateNumber = myNumbers[i];

}



Compare each number with all the previous numbers. For example:

boolean duplicateExists = false;
int duplicateNumber;

for (int i = 0; i < 10; i++)
for (int j = 0; j < i; j++)
if (myNumbers[i] == myNumbers[j])
{
duplicateExists = true;
duplicateNumber = myNumbers[i];

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

Compare each number with all the previous numbers. For example:

boolean duplicateExists = false;
int duplicateNumber;

for (int i = 0; i < 10; i++)
for (int j = 0; j < i; j++)
if (myNumbers[i] == myNumbers[j])
{
duplicateExists = true;
duplicateNumber = myNumbers[i];

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Java program to identify duplicates in a sequence of ten intgers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Is removing duplicate file on computers dangerous?

It's only dangerous if you delete duplicate files without thinking and don't use a good software for finding duplicates. For example, some duplicate finders compare files by name only and thus delete files that are not actually duplicates. If you want to stay completely safe, get an advanced program like Easy Duplicate Finder (or a similar program with similar features) and select "Compare files by content" in the settings (or "byte-by-byte comparison" depending on the program). That way the duplicate finder will only show you exact duplicates.


Where dowe define interrupts in 8086?

Breaking the sequence of program


What does program counter contain?

Program counter is a processor register that indicates where a computer is in its program sequence. It contains the address of the memory location.


Function of a program counter?

Program Counter is just a synonim for Instruction Pointer.


The binary sequence that instructs the CPU to run the programming code is called a?

executable program


What is a finite set of instructions that specify a sequence of operations?

A computer program.


What is meant by flow of execution a program?

That means to load a computer program into a computer's memory, and have the computer carry out the instructions in the program.


What is used to uniquely identify a record in a database program?

index field


Can you use scanf to get a string to a c program?

Certainly. That's what sequence %s is good for.


Which is the keyword of shell 1.shift 2.readonly 3.unset 4.ls?

answer is ls.. ls is command outside of the unix kernel.. To identify this if you do locate &lt;command&gt; or which&lt;command&gt; you can identify the source of the program.. if you do locate&lt;keyword&gt; or which&lt;keyword&gt;.. you can't identify the source of the program... :)~ss


Which two extensions identify a program packaged by Windows installer?

.msi and .zap


How do you write a program that removes all occurrences of a given X in a given sequence of numbers?

You do nothing! A sequence of numbers will contain no X and so nothing needs doing!