Skip to content

Q2A Nether

Menu
  • Q2ANSWER Archive
  • Home
  • News
  • Categories
  • About
  • Contact
Menu

Pseudocode –

Posted on October 21, 2022 by admin

Pseudocode – Create logic for a program that continually prompts the user for a numeric value until the user enters 0. The application alternately passes the value to a method that squares the number and a method that cubes the number. The program displays the results before restarting the user. Create the two methods that square and cube a number passed to them and then return the calculated value. It’s hard to make a flowchart so I’ll invent a generic coding language

1 write “enter a number

read m

if n = 0 go stop at 2

sq = n*n

cu = cu*n

write (“n=”, n)

write (“n^2 = “, square)

write (“n^3 = “, cu)

return to 1

2 stop i’m having trouble making a flowchart so i’ll invent a generic coding language

1 write “enter a number

read m

if n = 0 go stop at 2

sq = n*n

cu = sq*n

write (“n=”, n)

write (“n^2 = “, square)

write (“n^3 = “, cu)

return to 1

2 stop Here is the pseudo code for you:

Square(x) method:

return x * x; // Square the value passed as input.

Cube(x) method:

return x * x * x ; //Cube the value passed as input.

Main() method:

while(true): // Repeats infinitely.

Ask x.

Read x.

if x == 0:

come back; // Stop execution.

y = Square(x) //Call the Square(x) method.

Print y. //Print the square of a number x.

y = Cube(x) //Call the Cube(x) method.

Print y.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Een ….. vangt geen vliegen (5)?
  • Hierin maken we een minder waterige jus d’orange. (13) letters (crypt.?
  • VREEMD HOOR DAT HET THEMA GELDT ZOLANG HET DUURT?
  • ONGEACHT 7 LETTERS – Puzzelwoorden?
  • GLANS 5 LETTERS – Puzzelwoorden?

LOREM IPSUM

Sed ut perspiciatis unde omnis iste natus voluptatem fringilla tempor dignissim at, pretium et arcu. Sed ut perspiciatis unde omnis iste tempor dignissim at, pretium et arcu natus voluptatem fringilla.

LOREM IPSUM

Sed ut perspiciatis unde omnis iste natus voluptatem fringilla tempor dignissim at, pretium et arcu. Sed ut perspiciatis unde omnis iste tempor dignissim at, pretium et arcu natus voluptatem fringilla.

LOREM IPSUM

Sed ut perspiciatis unde omnis iste natus voluptatem fringilla tempor dignissim at, pretium et arcu. Sed ut perspiciatis unde omnis iste tempor dignissim at, pretium et arcu natus voluptatem fringilla.

©2026 Q2A Nether | Design: Newspaperly WordPress Theme