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
leonid [27]
4 years ago
5

What is wrong with the following C++ code? How would you fix it? int sum; for (int i=0; i<1000; ++i) sum += i; { printf("Sum

of 0 to 999 is %d\n", sum);
Computers and Technology
1 answer:
enyata [817]4 years ago
4 0

Answer:

Correct code is:

int sum;

  for (int i=0; i<1000; ++i)

  sum += i;

      printf("Sum of 0 to 999 is %d\n", sum);

Explanation:

In the problem code there is a open curly open bracket after the sum+=1;.

This open bracket will give an To fix this code, we remove this bracket from  the given code.Then this code will calculate sum of all number from 0 to 999.And the last line of the code will print the sum.

You might be interested in
What can a user do using the Contact Group dialog box? Check all that apply.
RSB [31]

Answer:

1,2,4,5,7

Explanation:

Had the question

3 0
3 years ago
Read 2 more answers
What is the output of this program?
Leto [7]

Answer:

70 is the answer negative one begins from 83 and count down to 89, Therefore, 70 is is -4 and is chosen as the best answer

7 0
3 years ago
Consider the following modification to the Merge Sort algorithm: divide the input array into thirds (rather than halves), recurs
ehidna [41]

Answer:

The correct answer to the following question will be "n logn".

Explanation:

  • Time Complexity should be the same as the whole last particular instance, just the log base keeps changing with three.  
  • Throughout the circumstance of separating 2 arrays, we want one correlation. however, for splitting between 3-way arrays, will require 2 comparisons to sort.
  • However, after breaking the array into 3, we can lower the number of transfers by growing the comparison. So the time complexity would then persist the same, but the log should get base 3 as we've classified into different parts.

So the time complexity will be:

⇒  T(n)=3T(\frac{n}{3})+ O(n)

⇒          =O(n \ logn) \ with \ base \ 3

7 0
3 years ago
Why is Internet fraud becoming increasingly common?
Nikitich [7]
The internet has billions of users, and is gaining more everyday. As people gain more and more technological resources, it becomes easier for them to steal people’s information.
7 0
4 years ago
In preparing categorical variables for analysis, it is usually best to​ Select one:
Allushta [10]

Answer:

a. convert the categories to numeric representations

Explanation:

6 0
3 years ago
Other questions:
  • Under the advanced options screen, what startup option should be enabled in order to view what did and did not load during the b
    12·1 answer
  • What finger is used to key letter c
    12·2 answers
  • What is logical memory?
    15·1 answer
  • A __________ is when the sender cryptographically marks a message with its private key, which is achieved by a cryptographic alg
    12·1 answer
  • What tab should you choose to locate the copy and paste tool?
    10·2 answers
  • What subsection of the Internet requires specialized browser to access and is frequently used by cyber criminals and underground
    10·1 answer
  • Fuction table of JK-Flip flop?
    11·1 answer
  • Question 3 10 points Save Answer Many companies in the computer industry introduce new products and services frequently in an at
    7·1 answer
  • ¿Qué tipo de información deben proteger los sitios de comercio electrónico?​
    14·2 answers
  • A web application's code prevents the output of any type of information when an error occurs during a request. The development t
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!