[Solved] Pseudo code example [closed]


Pseudo code is meant to describe and describe the flow, structure and logical statements of a program or and algorithm (in most cases only parts of it) in a way that is easy to understand without needing to analyze actual code, and can also be understood by those without any programming knowledge.

Pseudo code can either consist of real code-like examples, or just pure text.

An example of a pseudo code for making a PBJ could look something like this:

MakePBJRoutine(input: peanut butter, jelly, bottom bread, top bread) 
Begin routine:
        Take bottom bread. 
        Spread peanut butter on bottom bread. 
        Spread jelly on bottom bread. 
        If want more jelly:
              Spread jelly on bottom bread. 
        Place top bread slice on bottom bread
        Return finished sandwich
End routine 

Meanwhile, it could also look like this.

makePBJroutine(input: P, J, TB, BB; Out: PBJ) {
     BB <- P;
     BB <- J;
     If(BB.J < PreferredJellyAmountConstant){
         BB <- J;
     } 
    PBJ <- (BB <- TB);
    Return PBJ;
}

solved Pseudo code example [closed]