USING A RAPTOR. creates a Raptor program that will find and display the sum of a
ID: 3708386 • Letter: U
Question
USING A RAPTOR.
creates a Raptor program that will find and display the sum of a list of positive numbers and the sum of a list of negative numbers entered by the user. stops input when the user enters a 0. validates user input. declares and uses valid variables with the appropriate data types. evaluates the input, processes the data and determines the appropriate solution. creates formulas that can produce correct results. shows mastery of algorithm design. incorporates 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. enters in the appropriate documentation.
USE a raptor program to solve the problem
Explanation / Answer
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
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.