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
1. I write about my travel experiences on my own personal ____?
alekssr [168]

Answer:

Hello There!!

Explanation:

1.blog

2.laptop

hope this helps,have a great day!!

~Pinky~

4 0
3 years ago
Friedman (1999) argues that "we are wrong to base health promotion in all societies on a Western framework for human development
Dovator [93]

Answers with Explanation:

A. Give at least two reasons why he believes this.

Friedman believes that health promotion based on Western framework for human development<em> unfairly criticizes the other cultures in the society.</em> Western framework values intellectual and economic achievements alone, which then <em>results to putting a great expense on the other essential human qualities.</em>

B. What crisis does he believe is happening in the most economically developed countries?

The crisis that is happening in the most economically developed country is the <em>devaluing of the other aspects which other human beings value in terms of individuality or families.</em>

C. What does he recommend to improve the programming for adolescent health?

He recommends that if changes were to be implemented for adolescent's health, <u>these have to be properly assessed regarding their effect on the adolescent's development,</u> including his/her family and other social relationships. Next is to check whether<u> it doesn't conflict with the adolescent's culture in the community that he belongs</u>. If it does, then it is essential to change it or find <em>another way which fosters</em><em> </em><em>the same goal.</em>

7 0
3 years ago
Personal computer is the rise of what?​
gogolik [260]

Answer:

Overuse injuries of the hand.

Obesity.

Muscle and joint problems.

Eyestrain.

Behavioural problems including aggressive behaviour.

6 0
3 years ago
A use case description is the best place to start for the design of the forms for a user interface.​ True False
Veronika [31]

Answer:

false

Explanation:

6 0
3 years ago
I hate school...............
butalik [34]

Answer:

Check your email.

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • Describe the best way to deal with a difficult co-worker?
    13·2 answers
  • ) how many bits are used for host number on the child network (subnet) , b) how many usable addresses can exist on this child ne
    9·1 answer
  • You are an IT technician at your company. The company has two small offices in different cities. The company's head office conta
    5·1 answer
  • Privacy Group of answer choices must be respected if we are to function as complete, self-governing agents is an absolute value
    5·1 answer
  • If your pulse is higher than your Target Heart Rate during exercise, what should you do?
    5·2 answers
  • The concept of "plug and play" is demonstrated by which of the following<br> scenarios?
    13·1 answer
  • Braxton is writing a program to design t-shirts. Which of the following correctly sets an attribute for color?
    7·1 answer
  • What are the benefits and risks of a client-server network?
    5·1 answer
  • Whats the flow in this code, and whats the risk that its creating and what can i do to fix it? (c language)
    10·1 answer
  • what must you consider when determining the efficiency of an algorithm? select two choices. group of answer choices the amount o
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!