This topic contains a solution. Click here to go to the answer

Author Question: To add 0.01 + 0.02 + ... + 1.00, what order should you use to add the numbers to get better accuracy? (Read 124 times)

sabina

  • Hero Member
  • *****
  • Posts: 563

Question 1

How many times is the println statement executed?

for (int i = 0; i < 10; i++)
for (int j = 0; j < i; j++)
System.out.println(i * j)

◦ 100
◦ 45
◦ 20
◦ 10

Question 2

To add 0.01 + 0.02 + ... + 1.00, what order should you use to add the numbers to get better accuracy?
◦ Add 0.01, 0.02, ..., 1.00 in this order to a sum variable whose initial value is 0.
◦ Add 1.00, 0.99, 0.98, ..., 0.02, 0.01 in this order to a sum variable whose initial value is 0.


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by sabina on May 6, 2020

Juro

  • Sr. Member
  • ****
  • Posts: 337
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 29% of students answer this correctly




sabina

  • Member
  • Posts: 563
Reply 2 on: May 6, 2020
Great answer, keep it coming :)


hollysheppard095

  • Member
  • Posts: 339
Reply 3 on: Yesterday
Excellent

 

Did you know?

Dogs have been used in studies to detect various cancers in human subjects. They have been trained to sniff breath samples from humans that were collected by having them breathe into special tubes. These people included 55 lung cancer patients, 31 breast cancer patients, and 83 cancer-free patients. The dogs detected 54 of the 55 lung cancer patients as having cancer, detected 28 of the 31 breast cancer patients, and gave only three false-positive results (detecting cancer in people who didn't have it).

Did you know?

Each year in the United States, there are approximately six million pregnancies. This means that at any one time, about 4% of women in the United States are pregnant.

Did you know?

There are approximately 3 million unintended pregnancies in the United States each year.

Did you know?

Egg cells are about the size of a grain of sand. They are formed inside of a female's ovaries before she is even born.

Did you know?

In the United States, there is a birth every 8 seconds, according to the U.S. Census Bureau's Population Clock.

For a complete list of videos, visit our video library