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
kondaur [170]
3 years ago
11

Given an array of integers and the size of the array, write a function findDuplicate which prints the duplicate element from the

array. The array consists of all distinct integers except one which is repeated. Find and print the repeated number. If no duplicate is found, the function should print -1.
Computers and Technology
1 answer:
Jlenok [28]3 years ago
5 0

Answer:

#include <iostream>

using namespace std;

void findDuplicate(int arr[], int size) {

  for(int i = 0; i < size; ++i) {

      for(int j = i+1; j < size; ++j) {

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

              cout << arr[j] << endl;

              return;

          }

      }

  }

  cout << -1 << endl;

}

int main() {

  int arr[] = {2, 3, 5, 6, 11, 20, 4, 8, 4, 9};

  findDuplicate(arr, 20);

  return 0;

}

Explanation:

You might be interested in
On mad max ps4, why does the v6 sound beter and healthier than the v8
nadya68 [22]
Um is that a question?

5 0
3 years ago
Instructions
Reptile [31]

The assignment is about Telephone, internal combustion engine, and electrical light.

<h3>What is file?</h3>

A file is a  computer system container for storing data. Files used in computers are similar in characteristics to  paper documents used in libraries and office files. There are different types of files like text files, data files, folders, binary and graphic files and these different types of files store different types of data. A computer's operating system can store files  on optical discs, hard drives,  or other types of storage devices.

In most operating systems, a file must have a unique name within a specific directory. However, when creating a file name, some characters are considered illegal and therefore cannot be used. A file name consists of a name with an extension, also known as a file extension. The file extension is the two to four characters after the period of the full file name.

To learn more about file, refer;

brainly.com/question/29055526

#SPJ4

8 0
1 year ago
These are statements given by witnesses under oath? A. Testimony B. Admissible Evidence C. Indirect Evidence D. Circumstantial E
Aneli [31]

Answer:A. Testimony

Explanation:when someone knows something about what happened in the case held in court or they had witnessed what happened; In order to actual testify on what they know they are called on the stand and they have to raise their hand as a sign to swear an oath before the can give their testimony in court.

8 0
3 years ago
.Suppose some functions have been entered into a local file named "weather.js". Write the correct SCRIPT tag to load the library
Doss [256]

Answer:

<script type="text/javascript" src="weather.js"></script>

Explanation:

we have to use above script tag to include weather.js file into our web page.

Here type attribute represents the type of the file which we are trying to include on the web page.src attribute represents the path of the file from where we want to include that into our web page.

Generally we can include our java script functions into web page in 2 ways. one is inline function we can write the code in web page <script> tag itself .another way is to write the code in a separate file as shown above and include it in the webpage

5 0
3 years ago
Describe how computer become <br> in the next 35 year
marin [14]
Well im going to say that it is going to be more advanced and easier to hack. Not only that but more and more people are going to be using it. You'll see ten year olds and five year olds using computers like they are professionals 
8 0
3 years ago
Other questions:
  • Write the steps for displaying multiple subtotal functions in excel.
    10·1 answer
  • What is f(-3) for the function f(a)=-2a2-5a+4?​
    10·1 answer
  • There is a simple pattern for derermining if a binary number is odd. What is it and why does this pattern occur?
    8·1 answer
  • You can italicize a word by selecting it and clicking the italics icon. what keyboard shortcut could you use instead of clicking
    12·2 answers
  • CodeHS 3.4.5. What is the code for four colored triangles.
    8·1 answer
  • First Person Who Answers Fast As Possible Will Be Marked As Brainiest ​
    12·1 answer
  • Define the terms of data and information .​
    6·1 answer
  • Need answer ASAP
    8·2 answers
  • Discuss seven multimedia keys​
    8·1 answer
  • How does naming affect a variable’s creation and use?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!