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
Sidana [21]
3 years ago
9

Write a function solution that, given an array A consisting of N integers, returns the number of fragements of A whose sum equal

s 0 (that is, pairs (p,q) such that P
Computers and Technology
1 answer:
zubka84 [21]3 years ago
3 0

Answer:

#include <iostream>

using namespace std;

void fragment(int arr[], int n){

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

       for (int x = 0; x < n; x++){

           if (x != i && arr[i] + arr[x] == 0){

               cout<< arr[i] << " , " << arr[x];

           }

       }

   }

}

int main(){

   int n = 7;

   int myArr = {1, 2, -1, -2, 0, 0, 3};

   fragment(myArr, n);

}

Explanation:

The C++ source code defines an array called "myArr" in the main program and its array size n. The void function "fragment" prints out the pairs of the array whose sum equates to zero.

You might be interested in
Which of the following is an example of physical noise?
solniwko [45]
What are the options

6 0
3 years ago
A wireless _____ area network is designed for devices in an area up to 50 kilometers (31 miles) using rf or infrared transmissio
gavmur [86]
Metropolitan. Hope this helps!
7 0
3 years ago
When writing potential test questions, it is very important to use vocabulary words in their correct form. Please select the bes
Ilya [14]
The answer is True.

Hope I helped!
6 0
4 years ago
Read 2 more answers
Where should citations be included in your research paper? Select all that apply.
yKpoI14uk [10]

Answer:

it would be the first one because it's the header and that's what applies

5 0
3 years ago
Assume that d is a double variable. Write an if statement that assigns d to the int variable i if the value in d is not larger t
mamaluj [8]

Answer:

That's because the value has reached the size limit of the int data type. ... you should use long rather than int , because long can store much larger numbers than int . If ... In other words, a float or double variable can't accurately represent 0.1 . ... If you're using Java to measure the size of your house, you'd need an electron ...

Explanation:

3 0
3 years ago
Other questions:
  • How does information technology most benefit people’s personal and professional lives?
    9·2 answers
  • The mods have peanuts for brains (it's true, I lost like 1k points to them for no reason)
    12·1 answer
  • Our readings so far explored computer hardware and software, in particular operating systems and application software. There are
    11·1 answer
  • . Write a swift programming code to perform following tasks a) Declare a variable that stores the age of a person b) Declare a c
    5·1 answer
  • A network administrator is reviewing a network design that uses a fixed configuration enterprise router that supports both LAN a
    8·1 answer
  • Which of the following shows a list of Big-Oh running times in order from slowest to fastest?
    7·2 answers
  • Travis just got promoted to network administrator after the previous administrator left rather abruptly. There are three new hir
    14·1 answer
  • The relationship between social media and the Internet is complex. Individual Internet behavior involves a myriad of factors tha
    6·1 answer
  • How do programmers recognise patterns, generalise and abstract information
    13·1 answer
  • Java can be procedural or object-oriented when it comes to programming. What is the difference between procedural and OOP?​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!