 # Trying to create solution Algorithm

How do you create a solution algorithm using pseudocode that compares two variables and can select one of two alternative actions?

pseudo code just means that you write it out in plain language, like:

``````input a number and assign it to "x"
input a number and assign it to "y"
add the two numbers and assign it to "sum"
print out "sum"
``````

There’s no real right or wrong way to write pseudo code. It is independent of the language you end up using. Give it a shot. What have you got so far?

Nothing yet! I was trying to find a good example for this problem and I got confused! I gave you an example. Just write out how you would solve the problem. For example, you have an if in there, so I might do:

``````input a number and assign it to "x"
input a number and assign it to "y"
add the two numbers and assign it to "sum"
if "sum" is less than 10
print - "A one digit number"
else
print - "More than one digit"
``````

There really are no rules to pseudo code. You’re just sketching out ideas.

This is a learning site. You’re expected to try to do it first. Try to do it an we can help you with it if it is a problem.

Forgive me, sometimes I can be a slow learner! So the variables would represent any number and basically I wouldn’t need to actually put them in the code? The code would be able to basically execute the sequence?

What I wrote is not code, it’s pseudo code. Whether or not you have to put the numbers in the code or pseudo code, that depends on what you are doing and what level of abstraction you want.

The code would be able to basically execute the sequence?

That’s what code does. But you asked about pseudo code. Pseudo code is an abstract representation of the idea of what you want to do, like an outline. Then you pick a language and write it out and it becomes code.