Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Creates a Raptor program that will find and display the largest of a list of pos

ID: 3707297 • Letter: C

Question

Creates a Raptor program that will find and display the largest of a list of positive numbers entered by the user. Stops input when the user enters a sentinel value. validate user input. Declares and uses valid variables with the appropriate data types. Evaluate the input, processes the data and determines the appropriate solution. Create formulas that can produce correct results. show mastery of algorithm design. incorporate logical conditions that covers all boundaries specified by the problem. uses defensive programming techniques. shows strong evidence of applying program development strategies as discussed in the reading

Explanation / Answer

To find the largest and smallest number in an array, take the first value of array as largest and smallest number initially, and test against all the values of array to find the appropriate values.

Declare Number[100] As Integer
Declare X, Largest, Smallest, Count As Integer
Set Count = 0

Write "Enter a number:"
Input X

While Number != 0
Set Number[Count] = X

// Take the first value of array as smallest and largest initially
IF Count equals 0 Then
Set Largest = Number[Count]
Set Smallest = Number[Count]
End IF

// Find the largest value in the array
IF Largest < Number[Count] Then
Set Largest = Number[Count]
End IF

// Find the smallest value in the array
IF Smallest > Number[Count] Then
Set Smallest = Number[Count]
End IF

Set Count = Count + 1
Write "Enter a number:"
Input X
End While

For (K = Count - 1; K >= 0; K++)
Write Number[K]
End For

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote