English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i need to design a logic for a module that would print every number from 1 though 10, and then i need to disign th esame thing but along with its square and cube, does anyone know the pseudocode for these?

2007-09-28 05:45:24 · 6 answers · asked by holysaintsentbygod 1 in Computers & Internet Programming & Design

this is programming logic and design

2007-09-28 05:56:26 · update #1

6 answers

c++:
for(int i =;i<=10;i++)
cout< /*prints numbers*/
int i;
cin>>i;
i = i*i;
cout< //squared
//same as above but
i =i*i*i;
cout< //cubed

although I agree that this is really something you should learn in your first lesson or two so if you cannot figure this out you should try studing more.

2007-09-28 05:52:50 · answer #1 · answered by mr_pickle18 2 · 0 0

Pseudocode is just you writing your logic down in easy to read instructions. As such, there is no single one way to do it. So unless your instructor has given you a reference on how they want it done, the following should work.

Also remember that using real code when asked for pseudocode will probably get you penalized.

START LOOP counting from 1 to 10
Print value of counter
Print value of counter squared
Print value of counter cubed
END LOOP

Are you sure that was all of the project? Seems rather easy.

2007-09-28 13:09:08 · answer #2 · answered by Anonymous · 0 0

Dim i as integer

For i = 1 to 10
Print i
Next i

For i = 1 to 10
Print i
Print i^2
Print i^3
next i

Note I don't know what your programming language is, so you have to adapt it like that. But I've been a programmer 20 yrs and the For Next loop option is your best way to go.

2007-09-28 12:49:45 · answer #3 · answered by CB 7 · 0 0

Whatever the language used to program, whatever the form required for the "pseudo code", this is an assignment for very beginners in programming (probably the first or second lesson).
If you can't do it, you have not understood (or, more likely, not studied).
We are here to help you when you are stuck, but NOT to do your part of the LEARNING process!
Go back to your books and start learning.

2007-09-28 13:22:03 · answer #4 · answered by just "JR" 7 · 0 0

hint: use a for loop

for i = 1 through 10
print i
increment i and start over again

for sqr and such you can use a different variable and do the calculation before printing
for i = 1 through 10
calculate j
print j
increment i and start over again

hope that helps!

2007-09-28 12:50:01 · answer #5 · answered by 8Curious8 3 · 0 0

In what language are you doing this in? Try going to www.programmersheaven.com for some help. Or post more information.

2007-09-28 12:48:54 · answer #6 · answered by micaso1971 5 · 0 0

fedest.com, questions and answers