Nota Pseudocode (15feb)
Nota Pseudocode (15feb)
PSEUDOCODE
DEFINITION:
Pseudocode is the text only describes the logic and the program flow of a computer program. Pseudocode
resembles plain English only. It is usually does not have a specific programming language syntax and
grammar.
Example of Pseudocode:
if credit card number is valid
execute transaction based on number and order
else
show a generic failure message
end if
Pseudocode (VB)
Computing the final price an item after figuring the discount
Notes for 3 types of instruction:
BEGIN
1. Request price of item Input (Request)
2. Request discount rate Process/calculate (=)
3. Discount=price of item times discount rate Output (Print)
4. Final price=price of item subtract discount
5. Print final price
END
(Sources: http://smkts.net/czul/s_computing.html)
So, once you study this code-You have to give an input to the total variable and the output should be a print
statement.The print statement depends on the decision statement IF which is done through comparison
1
ALGORITM REPRESENTATIVE
Program:
main()
{
int total; Functional program:
printf("Enter the value of total: ");
scanf("%d",&total); Input function(scanf)
if(total>70) Output (Printf)
{ Input fuction used at the end of the
printf("Pass"); program (getch)
}
else
{
printf("Fail");
}
getch();
}
- Difference
Pseudocode is a sentence-like representation of a piece of code WHILE
A flowchart is a symbolic representation of code, using box shapes and arrows
- Similarity
Flowcharts and pseudocode are both ways to show the steps taken by an algorithm to solve a problem