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
irina [24]
3 years ago
9

Array Challenge Have the function ArrayChallenge (arr) take the array of numbers stored in arr and return the string true if any

two numbers can be multiplied so that the answer is greater than double the sum of all the elements in the array. If not, return the string false. For example: if arr is (2, 5, 6, -6, 16, 2, 3, 6, 5, 3] then the sum of all these elements is 42 and doubling it is 84. There are two elements in the array, 16 * 6 = 96 and 96 is greater than 84, so your program should return the string true. Examples Input: [2, 2, 2, 2, 4, 11 Output: false Input: 11, 1.2, 10, , 1, 121 Outputt true
Computers and Technology
1 answer:
vampirchik [111]3 years ago
6 0

Answer:

The code is given as follows,

Explanation:

Code:

#include <stdio.h>

#include <string.h>  

int n; //to store size of array  

char* ArrayChallenge(int arr[]) //function returns string true or false

{

  int i, j;

  int sum = 0;

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

  {

      sum = sum + arr[i]; //count sum

  }  

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

  {

      for(j = i+1; j < n; j++) //loop for every two elements in array

      {

          if(arr[i]*arr[j] > 2*sum) //check if proudct of two elements > 2 times sum

          {

              printf("\n%d x %d = %d, 2xSum = %d\n", arr[i], arr[j], arr[i]*arr[j], 2*sum);

              return "true"; //If proudct of two elements > 2 times sum. return true

          }

      }

  }

  return "false"; // If proudct of two elements < 2 times sum. return false

}  

int main()

{  

  printf("\nEnter size of array: ");

  scanf("%d", &n); //read size of array

  int A[n]; //array of size n

  printf("\nEnter array elements: ");

  int i;

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

  {

      scanf("%d", &A[i]); //read array from stdin

  }

  printf("%s\n",ArrayChallenge(A)); //ccall function and print answer

 

  return 0;

}

You might be interested in
How do you find a single number or name you want in a
Tamiku [17]

Answer:

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

Explanation:

You can find a single number or name in a large worksheet containing thousands of numbers and names using the find and replacement feature in excel.

You can use Ctrl+F keyboard shortcut for finding and replacing features. When you press Ctrl+F, a dialog will get open, using this dialog, you can find the required number or name while entering in the search text box. Then, click on the Find button, if the worksheet matches the result, give you the matched result in the yellow highlighted color.

Also, you can use Ctrl+F to replace a name or number with some other name or number.

Alternatively, you can do this using the home tab, then find the option find and select under the editing group of commands.

8 0
3 years ago
ERP implementation probably will not require:
Mamont248 [21]

Answer:

c. just a few weeks to install.

Explanation:

ERP is known as Enterprise Resource Planning.ERP implementation involves software installation, transfer of the financial data to the new system, configuration of the users and processes and training the users on the software.

It also involves upgrades after installation,cross-functional teams, intensive training, high funding for both initial cost and maintenance. This whole process usually takes place between 6 months to 2 years. This makes option C which says it takes few weeks to install incorrect.

3 0
3 years ago
Read 2 more answers
The purchase and subsequent sale of a securities position in a customer account solely to generate commissions is____________.
Citrus2011 [14]

Answer:

Churning

Explanation:

Churning is termed as an act of a broker conducting immoderate trading in the account of client solely to generate commissions. It is an illegal and deceptive practice. It violates security laws. The purchase and subsequent sale of a securities that are little or insignificant to meet the investment goals of client can be the evidence of churning. Consequently it causes considerable losses in client's account or can produce a tax liability.

Churning occurs due to over trading by a broker to generate commissions by buying and selling stocks excessively on the behalf of investor. This often happens when broker has permissive authority over client's account.

5 0
3 years ago
PLEASE HELP ITS TIMED Ishmael would like to capture a selected portion of his screen and then capture actions he performs on tha
jek_recluse [69]

Answer:

Option B

<u><em>Hope this Helps!!! :)</em></u>

6 0
2 years ago
You use_____ to view an XPS file
Katyanochek1 [597]
Firefox
any web browser can open a xps file
4 0
3 years ago
Other questions:
  • What are the desirable qualities of a Product Vision?
    11·1 answer
  • When you sort a cell range using a to z or z to a, what is rearranged?
    5·1 answer
  • To keep a desktop computer or a server powered up when the electricity goes off in addition to protection against power fluctuat
    8·2 answers
  • The following algorithm computes the average height for a list of basketball player heights. Initialize a variable sum to 0. For
    11·2 answers
  • The space force enhancement function concerned with providing data on meteorological, oceanographic, and space environmental fac
    12·1 answer
  • The rules on the Internet for how messages are addressed and passed on are called ____ .
    15·1 answer
  • Write a void method named myMethod which prints "This is a void method" (without the quotes). Your method should be declared pub
    5·1 answer
  • In Outlook 2016, the Tell Me function can be accessed by
    15·2 answers
  • Ok so I’m using a word document and towards the bottom of the page it stops me from moving my text box any further down even tho
    13·2 answers
  • the first thing to do when your computer gives you an error message is A restart the computer B press the F2 key C write down th
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!