Write a function solution that, given an array A consisting of N integers, returns the number of fragements of A whose sum equals 0 (that is, pairs (p,q) such that P

Answers

Answer 1

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.


Related Questions

Anna is creating a digital portfolio, including her professional work showcasing the designs she created. What should she add to each work?

A. brief description of the work and project details
B. only title of the work
C. only date and title of the work
D. only project details of the work

Answers

A. Brief description of the work and project details.

Consider the following Java program. Which line implements an interface method?import java.awt.event.*;import javax.swing.*;public class MouseWhisperer extends JFrame implements MouseListener { MouseWhisperer() { super("COME CLOSER"); setSize(300,100); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); addMouseListener(this); setVisible(true); } public void mouseClicked(MouseEvent e) { setTitle("OUCH"); } public void mousePressed(MouseEvent e) { setTitle("LET GO"); } public void mouseReleased(MouseEvent e) { setTitle("WHEW"); } public void mouseEntered(MouseEvent e) { setTitle("I SEE YOU"); } public void mouseExited(MouseEvent e) { setTitle("COME CLOSER"); } public static void main(String[] args) { new MouseWhisperer(); }}Select one:a. addMouseListener(this);b. public class MouseWhisperer extends JFrame implements MouseListener {c. public static void main(String[] args) { new MouseWhisperer(); }d. public void mouseEntered(MouseEvent e) { setTitle("I SEE YOU"); }e. setVisible(true);

Answers

Answer:

ok your1 one is your answer

Explanation:

happy new year 2021 please mark me brainlist

What tool should be used to remove fields and format data when importing?

A.)Power Query Editor

B.)Relationship builder

C.)3D Maps (Power Map)

Answers

Answer:

A.)Power Query Editor

Explanation:

Power Query editor is a Microsoft Office application, it can be utilized to remove fields and format data when importing files.

To remove fields, a user will click on the fields he wants to remove, then right-click to select Remove Columns on the menu, and under the same menu select Remove Columns from the sub-menu.

It is also used in formating data in the table created.

The five types of personal computers are: desktops, laptops, tablets, smartphones, and ________.
a) microcomputers.
b) wearables.
c) macrocomputers.
d) midranges.

Answers

Answer:

B. Wearables.

Explanation:

These are tagged to be a category now in the technology as they are seen to make up the fifth type of personal computers in the question above. These are seen to be attached on the body or sometimes embedded to our outfit and also in other cases hung on a part of our body. They are counted to range from fitness trackers to smart watches, headsets etc. They are said to posses microprocessors which aid their functional ability through its use of the internet.

Answer:

Explanation:

B. Wearables.

Explanation:

These are tagged to be a category now in the technology as they are seen to make up the fifth type of personal computers in the question above. These are seen to be attached on the body or sometimes embedded to our outfit and also in other cases hung on a part of our body. They are counted to range from fitness trackers to smart watches, headsets etc. They are said to posses microprocessors which aid their functional ability through its use of the internet.

Find the names of these cities with temperature and condition whose condition is neither sunny nor cloudy.

a. SELECT city, temperature, condition FROM weather WHERE condition NOT IN ('sunny', 'cloudy');
b. SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN ('sunny', 'cloudy');
c. SELECT city, temperature, condition FROM weather WHERE condition IN ('sunny', 'cloudy');
d. SELECT city, temperature, condition FROM weather WHERE condition BETWEEN ('sunny', 'cloudy');

Answers

Answer:

The answer is option A "SELECT city, temperature, condition FROM weather WHERE condition NOT IN ('sunny', 'cloudy')"

Explanation:

* SQL is a standard language for storing, controlling, manipulating and recovering information in databases. It represents Structured Query Language

* SQL can execute queries against a database, recover information from a data set, embed records in a database, update records in a database, erase records from a database, make new databases, make new tables in a data set, make put away systems in a data set, make views in a database, set authorizations on tables, techniques, and perspectives.

* The IN operator when used can allow you to specify multiple values in a WHERE clause.

The IN operator is an easy way for multiple OR conditions.

PLZ HELP THIS ENDS TODAY
During slide show mode, hitting the B key will do which of these?

End your presentation

Blank the screen with black screen

Move back one page

Move to the first page of your presentation

Answers

Answer:

B or Period. Pressing the B key or period key pauses the slideshow and displays a black screen, which you can write on. Press the B or period key again to resume the slideshow.

Answer: It blanks the screen black.

You should use the arrow keys.

Explanation:

I tried it.

While rendering the homepage of a website, it takes a lot of time due to the thread being blocked in processing JS/CSS. What are the options that can be employed to better the performance in this situation?
a) Pick ONE OR MORE options Using code-splitting for JS files.
b) Compressing the JS files on the server-side.
c) Using preloading for CSS files.
d) Having important pages as static files.

Answers

Answer:

a) Pick ONE OR MORE options Using code-splitting for JS files.

b) Compressing the JS files on the server-side

Explanation:

Javascript is a multi-purpose programming language, it is used in web development as a scripting language for programming the interactiveness of the web application.

Loading and running the script from the server can take a lot of time, so, the file is compressed and split for faster loading.

Which of the following had already existed in Africa before the Portuguese arrived?
A. Widespread practice of Christianity
B. The Triangle trade
C. European colonialism
D. Extensive trade networks

Answers

Answer:

D. Extensive trade networks

Explanation:

Trade in in raw materials as well as manufactured goods and other items was already established in Africa before the coming of the Europeans. There were already many trade routes by which African Kingdoms traded in diverse commodities in many renowned kingdoms of Africa before the Trans-Atlantic slave trade.

Trading was carried out on land and by waterways, these existing trade network enabled the Europeans to have access to Africa . Without these existing trade routes, the penetration of the Europeans would have been more challenging.

Answer:

The answer is D. Exstensive trade networks

Explanation:

I just took the test it is correct :)

This is your code. >>> A = ['dog''red'] >>> B = [' cat', 'blue']>>>C = ['fish', 'green'] You can implement an array of this data by using by using

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The given Python code is:

>>> A = ['dog''red']

>>> B = [' cat', 'blue']

>>>C = ['fish', 'green']

We can implement an array of this data by using the dictionary in Python.

Dictionary in python:

A dictionary in python stores (key-value) pairs. For example, we can implement the -given arrays A, B, and C in the dictionary as given below:

d={'dog : red', 'cat : blue', 'fish : green'}

print(d['dog']) # Get an entry from a dictionary; prints "red"

print('cat' in d)    # Check if a dictionary has a given key; prints "True"

d['fish'] = 'black'    # Set an entry in a dictionary

print(d['fish'])      # Prints "black"

# print(d['elephant'])  # KeyError: 'elephant' not a key of d

print(d.get('elephant', 'N/A'))  # Get an element with a default; prints "N/A"

print(d.get('fish', 'N/A'))   # Get an element with a default; prints "black"

del d['dog']        # Remove an element from a dictionary

print(d.get('dog', 'N/A')) # "dog" is no longer a key; prints "N/A"

Answer: by using lists but not by using the array module.

Explanation: Correct on Edg 2020.

Your internet is out, and devices connected by WiFi and ethernet will not connect. You check several websites, and all your packets fail. You then ping a website with an IP address, and to your surprise, it's a success. Which would you do next? a) Open the DNS settings on your router and try using a different DNS b) Open the DHCP settings on your router and try using a different pool of private IP addresses c) Open the Port Forwarding settings on your router and try turning on UPnP d) Open the Network settings on your router and try adjusting the default gateway e) Open the Network settings on your router and try turning off your firewall

Answers

Answer:

a) Open the DNS settings on your router and try using a different DNS.

Explanation:

The DNS or domain name service is a protocol that majorly assigns a URL string to an IP address. This is because the IP address as a number is easily forgotten.

In the question above, the operator could not access the websites with the URL name but can confirm connectivity to the site with its IP address. This means that the IP address can be used to access the websites directly, so, the DNS protocol is either not configured or is down.

Create a function called makePositive that accepts a single argument: an integer array. The function should walk through the array and change any negative numbers to positive. You can assume that the array passed to the function will have a 0 at the end of the array. In other words, you do not know the size of the array; you instead know that a certain condition will be true at the end of the array.

Answers

Answer:

This solution is implemented in C++

void makePositive(int arr[]){

   int i =0;

   while(arr[i]!=0){

       if(arr[i]<0){

           arr[i] = abs(arr[i]);

       }

       i++;

   }

   i = 0;

   while(arr[i]!=0){

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

    i++;

}  

}

Explanation:

This defines the function makePositive

void makePositive(int arr[]){

This declares and initializes i to 0

   int i =0;

The following iteration is repeated until the last element in the array

   while(arr[i]!=0){

This checks if current array element is negative

       if(arr[i]<0){

If yes, it changes it to positive

           arr[i] = abs(arr[i]);

       }

The next element is then selected

       i++;

   }

This sets i to 0

   i = 0;

The following iteration prints the updated content of the array

   while(arr[i]!=0){

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

    i++;

}  

}

See attachment for full program which includes the main

HURRY PLEASE
Maria is creating a game that will need a random number. Which line of code should be included in this program?
import random
print(random number)
1num = random
create random

Answers

Answer:

import random

Explanation:

Using the random module in python you could generate a random number.

Answer: Import

Explanation:

The OR operator displays a record if any conditions listed are true. a. Trueb. False

Answers

Answer:

True

Explanation:

I will answer using the following illustration (in python)

a = 2

b=3

if a ==2 or b == 4:

  print("Good!")

When the above program is run, the program will print Good!

Why?

Because according to the OR operator, only one condition (in this case; a = 2) has to be true

The other condition may or may not be true.

Hence, the anwer to your question is true

which web design concept is most closely related to elements that symbolize the real world​

Answers

Answer:

it is A A metaphor

Explanation:

According to Debevec, what has been one of the biggest challenges in computer graphics?

Answers

Answer:

making the computer-generated models move realistically.

Explanation:

Paul Ernest Debevec is a known personality in the world of computer graphics. As a researcher in computer graphics development, he realized that there are many challenges facing graphics development, and one of the biggest challenges in computer graphics is the ability to make the computer-generated models or human face move realistically.

Hence, in this case, the correct answer is "making the computer-generated models move realistically."

enumerate the the risk in the preparation and cooking in starch and cereal dishes and other food​

Answers

———————————————————.

When two well-informed people have different perspectives on a problem, it is often because they are focusing on a different approach to the problem, not that one side is right and the other is wrong.

a
False

b
True

Answers

Answer:

B. True.

Explanation:

The problem-solving process can be defined as the systematic approach used to identify and determine the solution to a particular problem.

The steps involved in the problem-solving process are;

1. Identify and define the problem: this is the first step to be taken in solving a problem. This is to ensure that, the focus is on the main issue or situation and all efforts is channeled in the right direction rather than the symptoms.

2. Gathering of information: this helps to consider the options available in solving a problem effectively.

3. Consider your options: this helps to compare the available and viable solutions to the problem.

4. Weigh disadvantages and evaluate a solution: you weigh the disadvantages of each solution, before choosing the one with the least disadvantages.

When two well-informed people have different perspectives on a problem, it is often because they are focusing on a different approach to the problem, not that one side is right and the other is wrong. Considering the fact that, all humans and intellectuals have different perspectives on a problem, the technique or approach that would be adopted by them to proffer a solution to the problem is most likely to differ. Thus, it's possible to have more than one approach to proffer a solution to the same problem.

It is not really important to organize your photos because you know that they are on your computer. (TRUE/FALSE)

Answers

Answer:

It is important

Explanation:

if not it'll be hard to find them in a cluttered mess of scattered photos

Answer: FALSE

Explanation: it is false because you can lose all those photos or even just misplace some photos that are gonna be lost.

What is an example of a functional requirement?

a
The software will be marketed to parents of colorblind children.

b
Schools will pay for the software.

c
The software will run on iPhones.

d
The software will allow users to apply a filter to simulate colorblindness to images.

Answers

Answer:

d. The software will allow users to apply a filter to simulate colorblindness to images.

Explanation:

A functional requirement can be defined as a description of the process or service that a system and all of its components is required to offer and perform, in order to support an end user's task.

Simply stated, a functional requirement is a description of the intended functions of a computer system.

The output of a system under certain input (conditions) is based on the functional requirement of the system and as such determines its behavior.

The various types of functional requirement are business rules, reporting requirements, certification requirements, transaction handling, audit tracking, external interfaces, administrative functions etc.

An example of a functional requirement is that, the software will allow users to apply a filter to simulate colorblindness to images.

FASTTTT
which function calculates the arithmetic mean of list values?
Max
count
average
self​

Answers

the excel AVERAGE function. so answer is average

to display only rows and columns that meet the specified condition or criteria computer​

Answers

Is there a question or is this a fact

Write the line of Python code that calculates and prints the answer to the following arithmetic expressions.

a. 5 to the 3th power
b. The sum of 4 and 6 multiplied by the quotient of 34 and 5 using floating point arithmetic.

Answers

Answer:

Explanation:

If the chosen programming language for this is Python and you only want the code to calculate the expression and print it then these are the following codes

a.   print(5**3)

b.  print((4+6) * (34 / 5))

Each one of these lines of code will calculate the arithmetic expressions and print the answer to the screen.

Imagine that you are in the market for a digital camera. Would it be better for you to purchase a high-quality digital camera or a mobile camera? Explain your answer by providing three reasons why your choice suits your needs.

Answers

Answer:

HI

I would be choosing digital camera

Explanation:

Reasons

1 the picture quality is amazing

2 mobile camera is also good but I already have

3 I don't have any 3rd reason

To take pictures that should be of high quality to capture the interest of readers. So, if I am in the market to purchase a camera, I would go for a camera that is of high quality. Even though a mobile camera would be less expensive, a high-quality digital camera has features that can be manipulated to get a quality photo that would also last.

The______ process of NLP normalizes words into base or root from

Answers

Answer:

stemming and lemmatization

Explanation:

i said so

_____ are labels for data, while _____ tie values together into one entity.

Answers

Answer:

Rows and Columns

Explanation:

My teacher told

Using a while loop, create an algorithm extractDigits that prints the
individual digits of a positive integer.
For instance, extractDigits(54321); would create the output:
1
2
3
4
5
Hint: The % and the / operators are going to be very useful in this program.
How can you use these to extract the last digit of the glven number?

Answers

Answer:

Follows are the code to this question:

#include <stdio.h>//defining header file

void extractDigits (int n)//defining a method extractDigits that holds

{

int x;//defining integer variable

   while (n > 0)//defining while loop for check value is greater than 0

   {

       x = n % 10;//holding remainder value

    n = n / 10;// holding quotient value

       printf("%d\n", x);//print remainder value

   }

}

int main ()//defining main method

{

extractDigits (54321);//calling above method by passing integer value

}

Output:

1

2

3

4

5

Explanation:

In the above-given code a method "extractDigits" is defined that accepts an integer parameter, and inside the method an integer variable is declared, that use while loop to check value is greater than 0, and calculate the individual digits, and print its values, and inside the main method we call the above method.    

True or false The List interface defines a collection for storing elements in a sequential order.

Answers

Answer:

True

Explanation:

A list is a collection where the elements are stored in the ordered sequence and it allows access to each of he elements by its position in the sequence. It allows duplicate values to be stored. It also allows insertion of elements and positional access.

A list is one of the three major categories of the Java collections. The other two categories are maps ans sets.

What is the name given to a value that does NOT change when used within a formula? *



A. Address

B. Reference

C. Constant

D.Function​

Answers

The answer is C. constant.

Formulars can contain different values, which may be variables or constants. Hence, values which does not change when used within a formula are called constants.

Constant are some times referred to as hard-coded values, as they cannot be aytwrwd within a formula.

Variables, on the other hand coukd taken up any specified value within the formula, as they are designed to be subject to change.

Learn more : https://brainly.com/question/14826269

1. Hypothesis: It is easier to establish an ethical work environment in a non-profit organization than in a for-profit organization. Provide three facts or opinions that support this hypothesis. Provide three facts or opinions that refute the hypothesis.

Answers

Answer:

Explanation:

Nonprofit organizations may have more possibilities to remain ethical because their work is not aimed at capital, but at the welfare of something or some situation.

When money is not involved in organizations, things become more honest and simple.

Usually people involved in nonprofit organizations have a different worldview and want to change reality.

In a non-profit organization, a social good is sought, as opposed to an organization that aims at money, but there are people who only use non-profit organizations as status.

Even though the environment aiming at a change in reality can become a work without ethics and that breaks the social rules.

What makes people truly ethical are people, a for-profit organization can be a more ethical environment than a non-profit organization.

PLS HELP Select the correct answer from each drop-down menu.
Nina is writing an assignment on JavaScript. Help her complete the following sentences.

If the property “length” of a string object is applied to the string “JavaScript", the result would be {blank} (10, 5, or 8.)
For date object, the initial value of the newly created object “mydate” is the {blank} (previous', current, or next day's) date and time.

Answers

Answer:

i think its 5 then current

Explanation:

Answer:

10, current

Explanation:

Just took the test and got it right

happy to help !!

Other Questions
How are migrants treated by migra agents? simplify:4 x - -5 + 3x- x+2 - 7 Carlos completed x3 squats as part of his football workout. if x=5, how many squats did he complete? PLS PLS PLS I REALLY NEED HELP THIS IS SOOO OVERDUE!!! PLZZZ I WILL DO ANYTHING!! BRAINLIEST AND 20 POINTS IF CORRECT!! DO NOT ANSWER IF YOU DO NOT KNOW WHAT THE ANSWER IS!!! PLEASE HELP!! How are investment, productivity, and income related within a company? Use details to support your answer. PLZ HELP! THIS IS DUE IN A FEW MINS!What would happen to work and power if the mass of the person walking was increased or decreased? EXPLAIN. Drag and drop the answers into the boxes to correctly convert between decimals, fractions, and percents. The density of mercury is 13.6 g/cm? What is this value in kg/m?? 33 = -u/4please help me i really confused...... Can someone help me with my Spanish is it Tuvo or tenia 211 is 500% of what number DOES ANYONE KNOW HOW TO FIND WHAT SLOPE REPRESENTS??? PLEASE HELP ME In the Mandarin-speaking world, which is the most important thing for a child to do?have funplay sportslearn as much as possible negative 4 divided by 3 as a fraction. Tybalt sends a letter to Romeos house inviting him to fight against him. Lets imagine that Romeos father has received the letter. You are Romeos father. Answer the letter. which values of x are solutions to the eqaution below? 4x^2-30=34 Can Someone please help me quickly ASAP 2. Choose a well-known company, and describe at least three qualities that you associate with that company or brand. Explain why you associate those qualities with that brand. (1-6 sentences. 3.0 points) TIP: This can be the same company you used in question 1 above, or it can be different. If Rachel can reach 91 inches high, AC = 2x, and BC= 5x+7, how tall is the object she'sreaching for (AC)?a) 24 inchesb) 13 inchesc) 67 inchesd) 91 inches Josh runs 6 miles in 55 minutes. At the same rate, how many miles would he run in 44 minutes? The width of the rectangle is 75% of its length.A rectangle with length 24 inches.a. What is the area of the rectangle?b. The length of the rectangle is doubled. What percent of the length is the width now? Explain why de posada went to Colombia what what he learned there Steam Workshop Downloader