Programming > CODING SOLUTION > PROGRAMMING/SOFTWARE > Alexander Hamilton High School SCIENCE 101 Lists and Procedures Psuedocode (All)
Alexander Hamilton High School SCIENCE 101 Lists and Procedures Psuedocode Practice Situation A: Takes the list lotsOfNumbers and uses a loop to find the sum of all of the odd numbers in t ... he list. Displays the sum. Sum ← 0 FOR EACH item IN lotsOFNumbers { <IF (INDEX mod 2 = 1) { <sum + list [i]> } > } DISPLAY (sum) Situation B: Write a procedure that takes a positive integer as a parameter. If the number given to the procedure is no more than 30, the procedure should return the absolute difference between that number and 30. If the number is greater than 30, the procedure should return the number doubled. n ← input IF (n ≥ 0) { <IF (n ≤ 30) { <n← 30 - n DISPLAY n> } ELSE { <n← n * 2 DISPLAY n> } } Situation C: Write a procedure ConvertToBinary that takes an input as a number from 0 to 16 (including 0 but not 16) and converts it to a binary number. The binary number should be returned as a list. [Show More]
Last updated: 2 years ago
Preview 1 out of 3 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
Jan 15, 2023
Number of pages
3
Written in
All
This document has been written for:
Uploaded
Jan 15, 2023
Downloads
0
Views
147
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·