Thursday, November 14, 2019

Pseudocode


Pseudocode


  • Pseudocode is an informal program description that does not contain code syntax or underlying technology considerations. Pseudocode summarizes a program’s steps (or flow) but excludes underlying details.
  • The System designer or Software designer is make pseudocode for a particular problem.
  • Pseudocode cannot be compiled nor executed, and there are no real formatting or syntax rules. It is simply one step - an important one - in producing the final code
  • There are some alternatives to Pseudocode. Some of them are Flowcharts, drakon-charts and Unified Modified Language (UML) charts. They will serve the purpose but they comparatively require more resources

Advantages of Pseudocode


  • Anybody can understand the pseudocode, what will that do.
  • There is no need to know the programming language.
  • It helps to understand the solution of the problem simply.


Programming Constructs

  1. Sequence
  1. Selectors
  1. Iteration
There are some words are use to input data
  • Input
  • Enter
  • Read
  • Get
There are some words are use to output data
  • Output
  • Display
  • Show
  • Print


Condition checking

IF (condition) then
      <statements to do>
else
      <statements to do>
End IF



Iteration in pseudocode

While(condition) then
        <statements to do>
        increment
End While



Simple pseudocode examples...



Example for sequence programme


  • Add 2 numbers and find the average of that numbers
Begin
    Input a number as num1
    Input a number as num2
    total=num1+num2
    average=total/2
    print total
    print average
End



Example for selection programme
  • Fine the user entered number  is odd or even

Begin
    Input a number as num
    if(num/2=0) then
        Display num is a even number
    else
        Display num is a odd number


Example for iteration programme
  • Find all multiples of 5 between 1 and 100


Begin
num=5
While (num <=100) then
Display num
num=num+5
End While
End

No comments:

Post a Comment