Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a for loop to sum all the integers between 1 and 1 0 0 . In 1 7 8 4 , Carl Gauss solved

Write a for loop to sum all the integers between 1 and 100.
In 1784, Carl Gauss solved problem #1 in seconds by noticing that:
1+99=100,2+98=100,3+97=100...(he was 7 years old at the time.)
Write a for loop to compute the sum in #1 using approximately half the number of executions of the for loop in #1.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

8 . What is the range of negotiation on the lease payment?

Answered: 1 week ago

Question

6 What is the balanced scorecard method?

Answered: 1 week ago