Computer Science > Solutions Guide > Gwinnett Technical College - CIST 1305Lesson_07_Homework_MuhammadRahman Algorithm Workbench SOLUTIO (All)
Algorithm Workbench 1. Design a ‘While’ loop that lets the user enter a number. The number should be multiplied by 10, and the result stored in a variable named ‘product’. The loop should it ... erate as long as ‘product’ contains a value less than 100. Solution: Module main() Declare Integer product = 0 Declare Integer num = 0 While product < 100 Display "Enter a number: " Input num product = num * 10 Display "Product: " , product End While End Module 2. Design a 'Do-While' loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The loop should ask the user whether he or she wishes to perform the operation again. If so, the loop should repeat; otherwise it should terminate. Solution: Module main() Declare Integer num1 = 0 Declare Integer num2 = 0 Declare Integer sum = 0 Declare String response Do Display "Enter first number: " Input num1 Display "Enter second number: " Input num2 sum = num1 + num2 Display "The sum is: " , sum Display "Enter Y to continue: " Input response While response == "Y" End Module 3. Design a 'For' loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50... 1000 Solution: Module main() Declare Integer counter = 0 For counter = 0 To 1000 Step 10 [Show More]
Last updated: 3 years ago
Preview 1 out of 6 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Mar 25, 2021
Number of pages
6
Written in
All
This document has been written for:
Uploaded
Mar 25, 2021
Downloads
0
Views
140
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·