1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
natka813 [3]
3 years ago
12

Write a java program to read elements in an array from user and count total number of duplicate elements in array.

Computers and Technology
1 answer:
Anna11 [10]3 years ago
8 0

Answer:

Explanation:

The following code is written in Java and is a function/method that takes in an int array as a parameter. The type of array can be changed. The function then creates a counter and loops through each element in the array comparing each one, whenever one element is found to be a duplicate it increases the counter by 1 and moves on to the next element in the array. Finally, it prints out the number of duplicates.

public static int countDuplicate (int[] arr) {

               int count = 0;

               for(int i = 0; i < arr.length; i++) {

                       for(int j = i + 1; j < arr.length; j++) {

                               if(arr[i] == arr[j])

                                       count++;

                       }

               }

               return count;

       }

You might be interested in
What describes Accenture's approach to automation?
Mrrafil [7]
<h2>Answer:</h2>

<h2>intelligence - centered</h2>

<h2>Explanation:</h2>

I hope it helps you

4 0
1 year ago
What is the purpose of creating a primary key in a database
ss7ja [257]

Answer:

Basically it creates a unique identifier for each row in your table and that can help you link your table to other tables using primary key as link

Explanation:

"Primary key allows you to create a unique identifier for each row in your table. It is important because it helps you link your table to other tables (relationships) using primary key as links."

7 0
3 years ago
Fill in the blank with the correct response.
Verizon [17]

Answer:

File structure.

Explanation:

HTML is an acronym for hypertext markup language and it is a standard programming language which is used for designing, developing and creating web pages.

Generally, all HTML documents are divided into two (2) main parts; body and head. The head contains information such as version of HTML, title of a page, metadata, link to custom favicons and CSS etc. The body of the HTML document contains the contents or informations of a web page to be displayed.

The file transfer protocol (FTP) client component of a full-featured HTML editor allows you to synchronize the entire file structure. Therefore, when you wish to share your entire html document over a network server such as a FTP client, you should use a full-featured HTML editor.

6 0
2 years ago
NTDS Quotas store NT Directory Service quota information that limits the number of Active Directory objects a user, group, compu
Anna35 [415]

Answer:

The anwer is advanced feature folder

Explanation:

Because NTDS QUOTAS is an advanced feature folder that stores NTDS quota information that limits the number of Active Directory objects a user, group, computer, or service can create.

3 0
3 years ago
Why do we allow electronic instruments to warm up before use?
son4ous [18]
Is not really a warm up!

we wait for the computer (electronic instrument) to load or process all the data in order to operate properly as its supposed to!
3 0
3 years ago
Other questions:
  • Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive.
    10·1 answer
  • Craig's annual take-home pay is $75,000. What is the maximum amount that he can spend per month paying off credit cards and loan
    7·2 answers
  • Which character is often used to identify registered trademarks and is available on the Insert tab and Symbols
    5·1 answer
  • Write a program using Python that prompts for an integer and prints the integer, but if something other than an integer is input
    11·2 answers
  • g Design a Boolean function called isPrime, that accepts an integer as an argument and returns True if the argument is a prime n
    14·1 answer
  • What is the final value for X ?<br><br> x= 1<br><br> x=13<br><br> x= x+3<br><br> x=0
    9·1 answer
  • Use the Windows ________ to check on a nonresponsive program. Select one: A. Backup utility B. Task Manager C. System Restore D.
    10·1 answer
  • My friend Leo wants to have an emergency plan for his final exams on University of Southern Algorithmville. He has N subjects to
    6·1 answer
  • What is the fullform of ETA in computer term​
    15·1 answer
  • I was just called a man in a wig ugh <br><br> Any tips for doxxing someone?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!