158k views
3 votes
create a raptor program that allows the user to enter a number. compute the cube of each number from 1 to the entered number. in a loop, the program should compute the cube of each number and the sum of the cube of each number. output should be the sum of the cubes. for example if the user enters 3, the computer would sum 1 x 1 x1 2 x 2 x 2 3 x3 x 3 in the loop. the output would be 36. Save your file using the naming format LASTNAME_FIRSTNAME_M05-1. Turn in your file by clicking on the Start Here button in the upper right corner of your screen.

User Ustun
by
8.0k points

1 Answer

5 votes

Final answer:

To create a Raptor program that allows the user to enter a number and computes the cube of each number from 1 to the entered number, we can use a loop. The program should calculate the cube of each number and the sum of the cube of each number, and then output the sum.

Step-by-step explanation:

To create a Raptor program that allows the user to enter a number and computes the cube of each number from 1 to the entered number, we can use a loop. Here is an example of how the program could be written:



DECLARE
number, sum, cube: INTEGER
BEGIN
sum := 0
number := INPUT("Enter a number: ")
FOR i FROM 1 TO number DO
cube := i * i * i
sum := sum + cube
END FOR
OUTPUT("The sum of the cubes is: " + sum)
END



In this program, the variable 'sum' is used to store the sum of the cubes. The variable 'cube' is used to compute the cube of each number in the loop. Finally, the sum is outputted to the user.

User Habibalsaki
by
7.8k points