Pseudocode -

Create the logic for a program that continuously prompts a user for a numeric value until the user enters 0. The application passes the value in turn to a method that squares the number and to a method that cubes the number. The program displays the results before reprompting the user. Create the two methods that square and cube a number passed to them and then return the calculated value.

3 answers

I t is hard to do a flow chart so I will invent a generic coding language
1 write "input a number
read n
if n = 0 go to stop at 2
sq = n*n
cu = cu*n
write ("n=", n)
write ("n^2 = ", sq)
write ("n^3 = ", cu)
go back to 1
2 stop
I t is hard to do a flow chart so I will invent a generic coding language
1 write "input a number
read n
if n = 0 go to stop at 2
sq = n*n
cu = sq*n
write ("n=", n)
write ("n^2 = ", sq)
write ("n^3 = ", cu)
go back to 1
2 stop
Here is the Pseudo code for you:

Method Square(x):
return x * x; //Squares the value passed as input.

Method Cube(x):
return x * x * x; //Cubes the value passed as input.
Method Main():
while(true): //Repeats infinitely.
Prompt for x.
Read x.
if x == 0:
return; //Stop executing.
y = Square(x) //Calls the method Square(x).
Print y. //Prints the square of a number x.
y = Cube(x) //Calls the method Cube(x).
Print y.