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]
3 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]3 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
If a pilot is converting standard time to UTC time and is given the time 1730 UTC, what would EST be?
bulgar [2K]

The answer is 12:30 hours

Coordinated Universal Time which is abbreviated as (UTC) is a successor to the Greenwich Meridian Time. Offset, UTC is zero hours ahead of GMT and is universally used. It regulates clocks and time. EST (Eastern Standard Time) is minus 5 hours from UTC. Thus, 17:30 in EST will be 12:30 hours






6 0
3 years ago
Read 2 more answers
what field in the ipv4 datagram header can be used to ensure that a packet is forwarded through no more than N headers
andrew-mc [135]

Answer:

Time to Live (or TTL)

Explanation:

This counter field is initially set at some value that is decremented by one each time the packet "hops." When the counter reaches zero the packet is disposed of.

5 0
1 year ago
Which of the following applications can be used as a data source for a Microsoft® Word® mail merge? A.Outlook Contacts B.Microso
Xelga [282]
<span>Word can pull data from a variety of data sources to perform a mail merge. As part of the Microsoft Office suite, Word easily accepts data from Outlook, Excel, and Access, and other data sources such as web pages, OpenDocument text files, and delimited data files stored as plain text. And if you don't have an existing data source, you can create a new one in Word.
ALL OF THE ABOVE

</span>
8 0
3 years ago
Read 2 more answers
Given class triangle (in files triangle.h and triangle.cpp), complete main() to read and set the base and height of triangle1 an
kow [346]

The C++ program that would complete the main () and set the base and height of triangle1 and of triangle2 is:

main.cpp

#include <iostream>

#include "Triangle.h"

using namespace std;

int main()

{

   Triangle Tri1;  

Triangle Tri2;

   double base1, height1, base2, height2;

   cout << "Enter a base for your Triangle1: ";

   cin >> base1;

   cout << "Enter a height for your Triangle1: ";

   cin >> height1;

   cout << endl;

   cout << "Enter a base for your Triangle2: ";

   cin >> base2;

   cout << "Enter a height for your Triangle2: ";

   cin >> height2;

   cout << endl;

   

   cout << "################################" << endl;

   

   cout << "Triangle with larger area:" << endl;

   if ((0.5)*base1*height1 > (0.5)*base2*height2){

      Tri1.setValues(base1, height1);

      Tri1.getValues();

      cout << "Area: " << Tri1.getArea() << endl << endl;

}

else{

 Tri2.setValues(base2, height2);

 Tri2.getValues();

    cout << "Area: " << Tri2.getArea() << endl;

}

   

   return 0;

}

Read more about C++ programs here:

brainly.com/question/20339175

#SPJ1

3 0
1 year ago
Which of these is a benefit of using the Sort option?​
Reika [66]

There are many benefits of using the shot options in Excel. Some benefits are allowing you to short by number,date,color, letter, columns,or text. This benefits the user because it allows the user to bring data up more easily.

I hope this answers is helpful

3 0
3 years ago
Other questions:
  • What is the maximum amount that OSHA can impose as a penalty on an employer for each Willful violation?
    11·1 answer
  • Mention 3 wast water draining system on home​
    7·1 answer
  • If you wanted to round $3.99 located in Cell B3 to the nearest dollar, what is the correct Microsoft excel formula?
    6·2 answers
  • A lamp outside a front door comes on automatically when it is dark, and when someone stands on the doormat outside the front doo
    7·1 answer
  • Write four overloaded methods called randomize. Each method will return a random number based on the parameters that it receives
    5·2 answers
  • Think about some of the most memorable and forgettable games ever created. They can be games that were discussed in this unit or
    10·1 answer
  • What do we call data that's broken down into bits and sent through a network?
    15·1 answer
  • How to create a network of relevant prospects?
    5·1 answer
  • Please answer me fast ​
    6·2 answers
  • Write a Pascal program that will prompt the user to enter the radius of a circle.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!