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
NEED BY 15 MINUTES PLEASE! WILL MARK BRAINLIEST!You can create special effects in an image using a camera or a photo-editing too
vovangra [49]

Answer:

Special Lenses For Special Effects. ... These specialty lenses may be designed with movable focal planes for amazing depth of field, or built to focus extremely close to tiny subjects for macro enlargements, or even to produce a specific type of soft focus that's flattering for portraits

The meaning of photo editing is the act of altering an image, simply put. But that’s oversimplifying a subject which is quite complex.

For example, some photo editing techniques are done manually, while others are conducted through automated software. Some photo editing is even done offline, on actual photographs, posters or other printed collateral.

Other terms for photo editing:

Image editing

Post-processing

Image/photo manipulation

Photoshopping

Image/photo enhancement

Explanation:

so they both are alike because they can both be used to edit photos and both are great to use

3 0
3 years ago
When would it be necessary to edit the information shown on an electronic business card?
Goryan [66]

Answer:

Really depends on your situation. If you specified, I'd have an asnwer

3 0
3 years ago
Read 2 more answers
Determine and prove whether an argument in English is valid or invalid. About Prove whether each argument is valid or invalid. F
yawa3891 [41]

Answer:

Each understudy on the respect roll got an A.  

No understudy who got a confinement got an A.  

No understudy who got a confinement is on the respect roll.  

No understudy who got an A missed class.  

No understudy who got a confinement got an A.  

No understudy who got a confinement missed class  

Explanation:

M(x): x missed class  

An (x): x got an A.  

D(x): x got a confinement.  

¬∃x (A(x) ∧ M(x))  

¬∃x (D(x) ∧ A(x))  

∴ ¬∃x (D(x) ∧ M(x))  

The conflict isn't considerable. Consider a class that includes a lone understudy named Frank. If M(Frank) = D(Frank) = T and A(Frank) = F, by then the hypotheses are overall evident and the end is counterfeit. Toward the day's end, Frank got a control, missed class, and didn't get an A.  

Each understudy who missed class got a confinement.  

Penelope is an understudy in the class.  

Penelope got a confinement.  

Penelope missed class.  

M(x): x missed class  

S(x): x is an understudy in the class.  

D(x): x got a confinement.  

Each understudy who missed class got a confinement.  

Penelope is an understudy in the class.  

Penelope didn't miss class.  

Penelope didn't get imprisonment.  

M(x): x missed class  

S(x): x is an understudy in the class.  

D(x): x got imprisonment.  

Each understudy who missed class or got imprisonment didn't get an A.  

Penelope is an understudy in the class.  

Penelope got an A.  

Penelope didn't get repression.  

M(x): x missed class  

S(x): x is an understudy in the class.  

D(x): x got a repression.  

An (ax): x got an A.  

H(x): x is on the regard roll  

An (x): x got an A.  

D(x): x got a repression.  

∀x (H(x) → A(x)) a  

¬∃x (D(x) ∧ A(x))  

∴ ¬∃x (D(x) ∧ H(x))  

Real.  

1. ∀x (H(x) → A(x)) Hypothesis  

2. c is a self-self-assured element Element definition  

3. H(c) → A(c) Universal dispatch, 1, 2  

4. ¬∃x (D(x) ∧ A(x)) Hypothesis  

5. ∀x ¬(D(x) ∧ A(x)) De Morgan's law, 4  

6. ¬(D(c) ∧ A(c)) Universal dispatch, 2, 5  

7. ¬D(c) ∨ ¬A(c) De Morgan's law, 6  

8. ¬A(c) ∨ ¬D(c) Commutative law, 7  

9. ¬H(c) ∨ A(c) Conditional character, 3  

10. A(c) ∨ ¬H(c) Commutative law, 9  

11. ¬D(c) ∨ ¬H(c) Resolution, 8, 10  

12. ¬(D(c) ∧ H(c)) De Morgan's law, 11  

13. ∀x ¬(D(x) ∧ H(x)) Universal hypothesis, 2, 12  

14. ¬∃x (D(x) ∧ H(x)) De Morgan's law, 13  

4 0
3 years ago
Task 03
Kamila [148]

Answer:

class Program {

 public static void Main (string[] args) {

   double number = 1.0;

   while(number >= 0.001) {

     Console.WriteLine (number);

     number /= 2;

   }    

 }

}

Explanation:

Always think carefully about what is in the condition of the while statement. In this case, you want the loop to be executed as long as the number is larger than or equal to 0.001.

3 0
1 year ago
There are three required elements needed to connect to the internet: hardware, web browser, and __________.
malfutka [58]

Yes the answer is D.internet service.

7 0
2 years ago
Read 2 more answers
Other questions:
  • Effective note-taking helps support<br><br> action.<br> distinction.<br> distraction.<br> retention.
    9·2 answers
  • What should you do prior to writing your business document?
    11·1 answer
  • Is spread spectrum transmission done for security reasons in commercial WLANs?
    13·1 answer
  • Which command can be used to find errors on a hard drive​
    6·1 answer
  • Look at the following function prototype. double mynewFunction(int); What is the data type of the function’s return variable?
    11·1 answer
  • The theory of logic set the foundation for what aspect of computing today?
    11·1 answer
  • How can i fix a all white phone screen
    11·2 answers
  • Write a list comprehension statement to generate a list of all pairs of odd posi
    7·1 answer
  • We love silky. she is very honest join this by using conjunction ​
    11·2 answers
  • How does xm satellite deter nonsubscribers from listening to its transmissions? Does this make the radio programing a private go
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!