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

Answers

Answer 1

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;

       }


Related Questions

9. What will help you determine the kinds of tools, equipment and utensil you will assemble, sanitize, inspect or check?
a. the kind of product to be produced
b. the method of food processing to be done
c. the raw materials to be processed
d. the availability of tools, equipment and utensils​

Answers

Explanation:

b. the method of food processing to be done

Describe the purpose and user requirements for the website.​

Answers

Answer:

The purpose and user requirements for the website is described below in details.

Explanation:

User Requirements represent how user expectations and wherewith they will communicate with the outcome. Use the characteristics, functions, and content expressed in your summaries to elaborate on your requirements. Your user synopses should describe the responsibilities your users want to perform on your site.

is it just me or do people delete other peoples questions and it shows up in my inbox staying its mine

Answers

Answer:

yessss same bru.h

Explanation:

Answer:

ive had that happen before i dont know why it happens

Which of the following identifies the most appropriate courses to take in high school for someone interested in becoming a mechanical engineer?
drafting- and math-related courses
math- and science-related courses
computer- and design-related courses
science- and computer-related courses

Answers

Answer: New questions in Health

Which member of the multidisciplinary team would help a patient improve his flexibility in the joints after a knee-replacement surgery? A. a physiot…

What are two advantages of a multidisciplinary team approach? better diagnosis in complex cases shared responsibility for decisions more opportunit…

MARKING PEOPLE AS BRAINLIST PLEASEEE HELP Where is the carbon dioxide picked up and the oxygen unloaded in the body? A:Arteries B:Veins C:Capillar…

Which healthcare professional would be primarily responsible for treating a patient for his anxiety disorder after a surgery? A. a nurse B. a nutr…

Do Now: What might be a situation where it might be important to identify 3 points somebody? What are different strategies that scientists could use …

Explanation:

input and output devices provide means of communication between computers and outer world

Answers

Answer:

See explanation

Explanation:

This question seem incomplete as what's required was not stated.

To answer this question, I'll assume it's a fill-in-the-gap question

The definition given above describes computer peripherals.

Peripherals is one of the links between a computer user and the computer itself.

Through peripherals such as keyboards, mouse, light pen , one can send input into the computer.

In the same vein, one can get outputs through peripherals such as the computer monitor, speakers, printers, etc.

Communication of the binary data via the voltage level for each time interval.
a
voice assistant
b
machine language
c
voltage
d
digital signal

Answers

Answer:

D

Explanation:

Answer:

D. Digital signal

Explanation:

Edge 2022

anyone else parents take your phone and you ask for it nicely and they say no and you ask why and they ignore you

Answers

Answer:

that's the same situation with me but with other objects cuz me no have ph0nE

Explanation:

when i was a smol chiLd i would get beat if i didnt  know my multiplication table l0l

yes, hate it so much

Why are backlinks a useful way to see if information on a website is reliable

Answers

Answer: It would help because the backlink could have the necessary details about the information being told. Hope it helps!

What is a letter that is written by someone you know and is used by a college during the application process?

Answers

Letters of recommendation.

Answer:

Letters of recommedation ..

Explanation:

Imagine you're in charge of managing an annual fest at your school. You have to select students and assign them different tasks. Write a short essay on the qualities and traits you would be looking for while selecting students. Explain why you think these qualities and traits are important. Also, describe how the lack of such qualities and traits would affect the work.

Answers

Answer:

Quality traits are important in many ways. A persons traits identifies them of how they treat you or how you might treat them. It is important to find good working people for the job. For example if one student is good at a specific task I might put them in that task or if another is good at stocking shelves or finding books I might put them in the library to help students find books. It is important as a supervisor to find people that listen and follow instructions not people that mess around and are unorganized. These qualities and traits are important to see the real potential of the employees. Finding the right people for the job will help the school and you as the supervisor to manage these employees. Making a application or employment sheet will help to find the right people making a sheet with some questions and have the potential employees fill it out to find their traits and skills.

Explanation:

Sorry I didn't have much background information on what you wanted me to write hope this works you can edit and change stuff though.

Also run this through Grammarly's plagiarism tester to see if it is plagiarism!

write a c++ program that prints the intial letter of any name​

Answers

Answer:

#include<iostream>

using namespace std;

int main(){

char str[20];

int i=0;

std::cout<<"Enter a name:" ;

cin>>str;

cout<<*str;

while(str[i]!='\0'){

if(str[i]==' '){

i++;

cin>>*(str+i);

}

i++;

}

return 0;

}

plzz help me with this question.........

Write a program to input a number find the sum of digits and the number of digits. Display the output also.......

sample input - 7359
sample digits - 24
number of digits - 4​

Answers

Answer:

please mark as brainliest!!

Explanation:

public class SumOfDigits{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Please enter a number to calculate sum of digits"); int number = sc.nextInt(); // Remember number/10 reduces one digit from number // and number%10 gives you last digit int sum = 0; int input = number; while (input != 0) { int lastdigit = input % 10; sum += lastdigit; input /= 10; } System.out.printf("Sum of digits of number %d is %d", number, sum); // closing Scanner to prevent resource leak sc.close(); } }

Do saving and loans associations have different categories?

Answers

Answer:

No

Explanation:

Because Savings and loan associations (S&Ls) are one of four types of "banks", there only one of four, not two of four

Kayla wants to know whether she should set her network up as a WAN or a LAN. What are the three questions you would ask her, and how would those questions affect your recommendation?

Answers

Due to it's typically massive size, WAN's are almost always slower then a LAN. The further the distance, the slower the network. One of the big disadvantages to having a WAN is the cost it can incur. Having a private WAN can be expensive.

Answer:

I would ask her: One, how large will the business be? Two, how secure she wants/needs the connection to be. And three, how much money she is willing to spend to install and/or maintain her network.

Since Kayla is just starting her business, my recommendation would be to set up her network as a LAN. A LAN is a group of computers and network devices connected together, and most often reside in one building. Kayla's business will start small, so it is not needed to set up her network as a WAN. WAN's are usually not restricted to a geographical location, and can be expanded to cover a whole country, or even a planet. A LAN would make sense in the coverage aspect, since Kayla's business has not expanded yet.

Depending on how secure she wants her network to be, she can choose whether or not she uses WAN or LAN. WAN is less secure, as it covers a large geographical area, while LAN is more secure. LAN is more secure because it covers a smaller area. I would recommend using LAN as it is better to have a secure network as a business.  

Finally, Kayla needs to address the cost of setting up and maintaining a LAN or WAN. I would recommend that Kayla uses a LAN because as a starting business, it is important to allocate money properly. LAN's usually cost less to install and maintain due to it's smaller geographical radius, so it would be best to choose to set up her network as a LAN.

Explanation:

What device is required to connect to the Internet?
O Wi-Fi
O an ISP
a router
a modem​

Answers

Answer:

modem

Explanation:

The primary piece of hardware you need is a modem. The type of Internet access you choose will determine the type of modem you need. Dial-up access uses a telephone modem, DSL service uses a DSL modem, cable access uses a cable modem, and satellite service uses a satellite adapter.

Answer:

D

Explanation:

Edg 2021

HELP ME!!! I WILL GIVE BRAINLY THINGY!!!

What does the code if (num2==50){ do?

Answers

Answer:

What subject is this?

Explanation:

is this math ?????????????????????

What are the two negative impacts of computer technology to the society?​

Answers

One negative is that people are getting very impatient. This is because people are getting used to things instantly coming up onto their screens. Another negative is that people are being manipulated more easily. Nowadays anyone can be an expert if they sound smart enough. Then they can spread their lies quickly to millions of people.

What kinds of circumstances would lead you to writing a function versus using a loop? please explain in simple terms

Answers

Answer:

1. You want to use parameters

2. You don't want your program to run multiple times

3. You want to call that snippet of code throughout your program

hope this helped :D

Which actions help to protect a computer and keep it running properly? Check all that apply.

performing regular scans
deleting any unwanted files
backing up files and other data
saving Internet browsing history
saving and storing all junk files

Answers

backing up files and othed date
saving and storing all junk files
deleting any unwanted scans

Answer:

ABC

Explanation:

100% EDGE 2022

How can you make the drawing tools contextual tab appear

Answers

Answer:

C. place the insertion point in any text in the text box.

Typically, the Ribbon contains the Draw tab. Here's how to add it, though, if you can't see it on yours. Customize the ribbon by selecting it with the right mouse click. Click OK after selecting the checkbox next to draw. Thus, option C is correct.

What make the drawing tools contextual tab appear?

If your Draw Tools are hidden, you can reveal them by bringing up the View menu, selecting Toolbars, and then selecting Drawing. Look at the Draw Tools' features for a bit.

When you click outside these objects, the tools in the contextual tabs are put away, giving you the options and resources you need to deal with them.

Clicking on the item causes the tab to reappear, and you can get them back. Your workspace remains uncluttered as a result.

Therefore, place the insertion point in any text in the text box.

Learn more contextual tab about  here:

https://brainly.com/question/14139335

#SPJ2

Submit a paragraph about how people earn income online.

Answers

Answer:

Selling services or products, generating traffic for ad revenue or investing in different types of products / companies.

Explanation:

Select the best answer from the drop-down menu. Sometimes people feel threatened by new ideas and different ways of doing things. This results in . conflict is resentment that a person is experiencing but doesn't express. conflict is the behavioral or action stage of conflict. This is often characterized by negative actions. Conflict can arise in the workplace because of personality issues, cultural differences, and .

Answers

Answer

Conflict

Latent

Manifest

Religious beliefs

Explanation:

Write 5-7 sentences about your own personal observations in which you have been part of a "filter". You might have experienced this is in your Twitter feed, specific advertisements, or your search engine results. Be specific.

Answers

Answer:

Answered below.

Explanation:

I made a search for a product on an online grocery store. The search results came in and I bought the product. On subsequent visits to the grocery store website or on browsing other sites, I had special advertisements pop up. These advertisements were suggesting products to me similar to the one I bought on the grocery store. It was a targeted advertisement that had been sent based on my recent searches and purchases on the site. So I knew that was a filter.

what is meant by astigmation​

Answers

Answer:

It is a condition where the eye isn't completely round

Explanation:

Answer:

is a common and generally treatable imperfection in the curvature of your eye that causes blurred distance and near vision. Astigmatism occurs when either the front surface of your eye (cornea) or the lens, inside your eye, has mismatched curves

Explanation:

How can internet affect business area? 


Answers

The communication between customers and businesses increases customer satisfaction and businesses are able to connect to the customers. it lets businesses go further to expand their service or product which can increases profit.

What is the other name of the horizontal column graph?
graph is also known as the horlzontal column graph.

Answers

Answer:

Side Graph mabye?

Explanation:

Answer:

A bar graph.

Explanation:

A bar graph is also known as the horizontal column graph.

I have a problem with my Nintendo DS lite does anyone know how to fix it?

Answers

Try checking if the battery is still working, they usually tend to give out at times.

put each sentence in the correct place please :)

Answers

the first image matches with the last sentence.

the second image (fireworks) match with the first sentence.

the third image (rocket) matches with sentence two.

and the last image matches the third sentence.

Answer:

sentence 1 -> picture in box 2

sentence 2 -> picture in box 3

sentence 3 -> picture in box 4

sentence 4 -> picture in box 1

Which statements are true? Select 4 options.

A class variable can be a different type of class.

A class variable can be a list of instances of a different class.

An instance of a class cannot be changed after it is created.

Functions defined in a class are called methods.

Variables defined in the constructor of a class can be accessed by the main program that uses instances of the class.

Answers

Answer: All of the answers are correct EXCEPT "An instance of a class cannot be changed after it is created.

Explanation: I've done the problem. Also, if you have an instance of a class, you can no longer change it. It is frozen in time as that one instance. If had a class defining pets and you made an instance dogA where the pet was a brown medium sized dog, dogA would always be a brown medium sized dog. I think, at least.

Answer: A class variable can be a different type of class.

A class variable can be a list of instances of a different class.

Functions defined in a class are called methods.

Variables defined in the constructor of a class can be accessed by the main program that uses instances of the class.

Explanation:

got it right on edgen

In my 4.3 Code practice: Question 1.
Every time I enter an age, it just continues to print **HUG**
What is wrong with my code?

Answers

Answer:

you have the (while) code in whenever it is greater than 0, print hug. if less than, then nothing so flip the inequality thing around again.

Hope this helps plz hit the crown

Other Questions
What must a scientist do in order to develop a testable hypothesis? O A. Find out whether the idea would be interesting to other scientists. O B. Determine whether the conclusion is supported by popular opinion. C. Ask a question that can be answered by making observations. D. Research accepted scientific theories to find one that is wrong. In a sample of 16 mini-golf balls, 6 are yellow and 10 are pink. If 2 balls are selected at random from the sample, one at a time without replacement, what is the probability that both balls are not pink? Please help with this problem I'm starting to get into anime, and have no idea what to watch. Anyone have any reccommendations? ( netflix and Hulu only plz) help asap I have 2 min What is the value of log: 3 3 Claire currently earns $25 per hour at her work. Her boss has decided to give her a 15% raise. What is Claire's new hourly wage? Help ASAP Please! If its wrong I wont give brainliestIsraelites fell to the Assyrians and the Babylonians as a result of A. No one wanted to build and secure walls around the nation B. The military was weak C. There was a flood which damaged farmer's crops D. Division and and formation of two separate Israelite Kingdoms, Judah and Israel What is 80% of 80?!? Pls help ASAP Cuatro nios jalan de manera separada un mismo carrito de baleros con un mismo desplazamiento, pero uno con un ngulo de 45, otro con un ngulo de 35, otro de 20 y el ultimo con un ngulo de 0, medidos con respecto al eje horizontal. Cul de los cuatro realiza un mayor trabajo, si la fuerza que se aplica cada uno de ellos es la misma? Selecciona el ngulo: what is the ulimate goal of an interest group The Earth's _____ provides protection from meteorite impacts by causing them to _____.please leave a simple answer There are different forms of energy and one form of energy can be converted into another. When we light a wax candle, the process is highly exothermic and on burning, the chemical energy of the wax gets converted into heat and light. A good source of energy is to be selected for the choice of work to be done. In ancient times, wood was the most common source of heat energy. We, in our daily lives, use various energy sources for doing the work. Nowadays we use diesel and electricity to run trains. We also use fossil fuels in vehicles which has some serious disadvantages, mainly air pollution. The recent example of air pollution was Smog in the National Capital Region of Delhi. This pollution was a result of burning Parali in northern states of the country, which affected the eyes and also caused serious respiratory problems.4(a) State the energy conversion that takes place when we light a wax candle. 1 4(b) List two criteria of selecting a source of energy for a specific work. 1 4(c) Write the names of two fossil fuels. 14(d) why are we looking at alternate sources of energy? 1 Find the perimeter of the large triangle Although the Declaration said that "all men are createdequal," women and minorities did not originally share thesame rights as white men. What can you conclude aboutthis? Help plz ill give extra points f Bonjour, je mappelle Sylvie, jhabite Deauville en Normandie. Le matin je vais lcole en bus. Jtudie beaucoup les mathmatiques et langlais. Aprs le collge, je vais en ville pied avec mes amis. Nous allons au caf Place Morny pour parler et manger un sandwich. Jadore Deauville. Samedi nous voyageons Paris en train pour aller au thtre parce-que nous aimons les pices. Jai besoin dune robe bleue et de sandales pour le voyage. Ma famille va manger au restaurant aprs la pice. Cest une pice clbre et trs drle. Nous rentrons du thtre en mtro pour aller lhtel. help me I don't get it Edward is extremely romantic and wants to give Bella an entire bouquet of pink snapdragons, her favorite flower. Unfortunately, Edward only has red snapdragons in his greenhouse. In order to produce the most number of pink snapdragons, what color flower should Edward cross with his red snapdragons? Can someone help me with this question?Thanks. Can somebody plz help answer both questions correct (only if u know how)WILL MARK BRAINLIEST WHOEVER ANSWERS THEM FIRST.. promise :DD