Advantage of Sentinels (2024)

Table of Contents
Answer: Other Sentinel Values

Answer:

There is no limit. As long as the user does not enter a 0,the program is happy to keep adding.This is a big advantage.Often you want a program to run until you tell it to stop.(Much like a car—you want it to keep running untilyou are done with it. It would be awkward if you had to tellyour car exactly how far you wanted it to go at the beginningof each trip.)

A big advantage of using sentinel values is that there isno limit to how many times a loop can execute,and that it ends gracefully when it is done.

If the user keeps entering big numbers, soon the sum willbe too large for the computer to handle.This is just like a hand calculator that has a limit on howlarge a number it can hold.But if the user were entering both negative and positive numbers,the sum might never get too large.Then the program could keep going and going.

Other Sentinel Values

A sentinel value should be a value that is never going toappear in data.Adding zero to a sum does not change the sum,so the program to add numbers could use zero as a sentinel value.If the list of numbers the user were adding had a zero in it,the user could just skip it without changing the sum.

Sometimes you know that there will never be any negativenumbers in a list of numbers to add.The program could be changed so that any negative numberacted as a sentinel value.Here is the program, with a blank in the loop condition:

' Add up numbers that the user enters.' When the user enters any negative number, ' print the sum and end the program.'LET SUM = 0'PRINT "Enter a positive number" INPUT NUMBER 'DO WHILE NUMBER ______ 0 LET SUM = SUM + NUMBER PRINT "Enter a positive number." INPUT NUMBER LOOP'PRINT "The sum is", SUMEND
Advantage of Sentinels (2024)
Top Articles
Average Salary Around the World
Just Dance 2024 Edition – Creative Director Discusses New Features and Just Dance+ Year 2
Design215 Word Pattern Finder
Compare Foods Wilson Nc
Urist Mcenforcer
Fat People Falling Gif
Blackstone Launchpad Ucf
Puretalkusa.com/Amac
Select The Best Reagents For The Reaction Below.
Student Rating Of Teaching Umn
Declan Mining Co Coupon
Camstreams Download
Jscc Jweb
Gfs Rivergate
Charmeck Arrest Inquiry
Connect U Of M Dearborn
Daily Voice Tarrytown
Sam's Club La Habra Gas Prices
Gdlauncher Downloading Game Files Loop
Google Flights Missoula
Convert 2024.33 Usd
Www Craigslist Milwaukee Wi
Wausau Marketplace
Foxy Brown 2025
Lakers Game Summary
Yog-Sothoth
Engineering Beauties Chapter 1
1145 Barnett Drive
Harbor Freight Tax Exempt Portal
Busted Mugshots Paducah Ky
As families searched, a Texas medical school cut up their loved ones
Funky Town Gore Cartel Video
Proto Ultima Exoplating
Pnc Bank Routing Number Cincinnati
How to Draw a Bubble Letter M in 5 Easy Steps
Solve 100000div3= | Microsoft Math Solver
Gideon Nicole Riddley Read Online Free
Weekly Math Review Q4 3
Edict Of Force Poe
Telegram update adds quote formatting and new linking options
How much does Painttool SAI costs?
Kerry Cassidy Portal
Topos De Bolos Engraçados
Electronic Music Duo Daft Punk Announces Split After Nearly 3 Decades
Mid America Irish Dance Voy
Join MileSplit to get access to the latest news, films, and events!
Rs3 Nature Spirit Quick Guide
Expendables 4 Showtimes Near Malco Tupelo Commons Cinema Grill
Love Words Starting with P (With Definition)
6463896344
Publix Store 840
WHAT WE CAN DO | Arizona Tile
Latest Posts
Article information

Author: Msgr. Benton Quitzon

Last Updated:

Views: 5714

Rating: 4.2 / 5 (43 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Msgr. Benton Quitzon

Birthday: 2001-08-13

Address: 96487 Kris Cliff, Teresiafurt, WI 95201

Phone: +9418513585781

Job: Senior Designer

Hobby: Calligraphy, Rowing, Vacation, Geocaching, Web surfing, Electronics, Electronics

Introduction: My name is Msgr. Benton Quitzon, I am a comfortable, charming, thankful, happy, adventurous, handsome, precious person who loves writing and wants to share my knowledge and understanding with you.