0% found this document useful (0 votes)
30 views3 pages

Pseudo Codes

This document discusses various pseudocode concepts including conditional statements like IF/THEN/ELSE and CASE/OF, iteration structures like FOR/NEXT loops and WHILE loops, procedures, functions, parameters, and variables. It provides examples of how to write pseudocode for tasks like totaling, counting, finding maximum and minimum values, averaging, and sorting arrays. Library routines are also mentioned as pre-written code blocks that perform common operations like mathematical functions.

Uploaded by

Amna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views3 pages

Pseudo Codes

This document discusses various pseudocode concepts including conditional statements like IF/THEN/ELSE and CASE/OF, iteration structures like FOR/NEXT loops and WHILE loops, procedures, functions, parameters, and variables. It provides examples of how to write pseudocode for tasks like totaling, counting, finding maximum and minimum values, averaging, and sorting arrays. Library routines are also mentioned as pre-written code blocks that perform common operations like mathematical functions.

Uploaded by

Amna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 3

PSEUDOCODES: ( everything)

-arrow used to assign values


~CONDITIONAL STATEMENTS:
1-IF THEN ELSE ENDIF
2- CASE OF ENDCASE

~ITERATION :
1- FOR counter _ TO _
OUTPUT “ @ “
NEXT counter

2- Counter<- 0
REPEAT
OUTPUT “ @ “
Counter<- Counter+1
UNTIL this condition is true

3- Counter <- 0
WHILE condition is true DO
OUTPUT “ @ “
Counter <- Counter+1
ENDWHILE

~TOTALLING :
Total <- 0
Total = Total + Count

~COUNTING:
Counter <- 0
FOR Counter _ TO _
…..
Counter = Counter + 1

~MAX AND MIN :


SET MAX TO 0 (LOWEST VALUE )
AND SET MIN TO 100 (HIGHEST VALUE)
THE FIRST COUNTER IS CHECKED AGAINST THESE VALUE AND THE MAX AND
MIN ARE SET ACCORDING TO THAT, FOR THE NEXT COUNTER THE VALUES WILL
BE COMPARED AGAINST THE PREVIOUS ONES INSTEAD SINCE THEY ARE THE
VALUES OF MAX AND MIN NOW.

~AVERAGE :
Average <- Total/ Count

~LINEAR SEARCH :
searches linearly along a counter for a true statement until it is found.

~BUBBLE SORT :
sorts the counters in ascending or descending orders e.g. temperatures.

~OPERATORS :
mathematical,
Boolean(AND, OR , NOT) ,
logical ( comparisons )

~PROCEDURES : are used to group and number of program statements for


better organization and maintenance of program, under a single name. Can be
called anywhere throughout the program to perform a task. Doesn’t return a
value.

-Syntax:
PROCEDURE name
(the code e.g OUTPUT “ @ “ )
ENDPROCEDURE

CALL procedure name

~FUNCTIONS : are used for the same purpose but returns a value back to the
caller of the function .
In a way, it's like the function is giving a gift back to the code that called
it.

basically it stores the value of the result that u get after the function is
performed and u can call it again.
It's like the function's way of saying, "Here's what I've done for you!" 🌟🤖

FUNCTION function name (parameter : the datatype)

the code whatever it is to perform a calculation etc

RETURN(parameter : datatype )

ENDFUNCTION

~PARAMETERS : are passed onto the functions or procedures (name) as a


variable with a data type specified. And arguments are the actual values u put
inside the paraments, that are used while performing that function or
procedure.

~LOCAL AND GLOBAL VARIABLES : LOCAL -assigned inside a loop or procedure


or function by using “declare”, won’t be functional outside that part of the
code hence u can avoid unintentional calling of variables.
GLOBAL- assigned outside the modules and can be modified or accessed in any
part of the program. Usually more complex to maintain and use.

~LIBRARY ROUTINES: are pre-written blocks of code that perform specific


tasks or operations. They are designed to be reused across different
programs to save time and effort in programming. The programming
IDEs usually provide these routines

e.g: MOD: returns the remainder of division


DIV: returns the quotient
ROUND: rounds the value ( value, number of decimal places)
RANDOM(): returns a random value 0 to 1 inclusive

You might also like