Pseudocode & flowchart examples

22,714 views 14 slides Apr 02, 2018
Slide 1
Slide 1 of 14
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14

About This Presentation

There are 10 Pseudocode and Flowchart Examples


Slide Content

C
PSEUDOCODE& FLOWCHART
EXAMPLES
10 EXAMPLES
www.csharp-console-examples.com

Pseudocode
•Pseudocode is a compact and informal high-level
description of a program using the conventions of a
programming language, but intended more for
humans.
•There is no pseudocode standard syntax and so at
times it becomes slightly confusing when writing
Pseudocode and so let us understand pseudo code
with an example.

PseudecodeSyntax
•FOR THOSE TUTORIALS I'LL USE THAT SYNTAX
•INPUT–indicates a user will be inputting something
•OUTPUT–indicates that an output will appear on the screen
•WHILE–aloop(iterationthat has aconditionat the beginning)
•FOR–a counting loop (iteration)
•REPEAT –UNTIL–a loop (iteration) that has a condition at the end
•IF –THEN –ELSE–a decision (selection) in which a choice is made
•any instructions that occur inside a selection or iteration are usually indented

Pseudocode & FlowchartExample 1
Add Two Numbers
1
2
3
4
5
6
7
8
9
BEGIN
NUMBERs1,s2,sum
OUTPUT("Input number1:")
INPUTs1
OUTPUT("Input number2:")
INPUTs2
sum=s1+s2
OUTPUTsum
END

Pseudocode & FlowchartExample 2
Calculate Perimeter of Rectangle
1
2
3
4
5
6
7
8
9
BEGIN
NUMBERb1,b2,area,perimeter
INPUTb1
UNPUTb2
area=b1*b2
perimeter=2*(b1+b2)
OUTPUTalan
OUTPUTperimeter
END

Pseudocode & FlowchartExample 3
Find PerimeterOf Circle using Radius
2
3
4
5
6
BEGIN
NUMBERr,perimeter
INPUTr
area=3.14*2*r
OUTPUTperimeter
END

Pseudocode & FlowchartExample 4
Calculate sales taxes
3
4
5
6
7
8
9
10
11
12
13
14
15
BEGIN
NUMBERprice,tax,taxRate,total
OUTPUT"EnterProduct Price"
INPUTprice
OUTPUT"Entertaxrate amoung1 and100"
OKUtaxRate
tax= price* taxRate/100
total= price+ tax
OUTPUT"Product tax="+tax
OUTPUT"Product total price="+total
END

Pseudocode & FlowchartExample 5
Check a Number is Positive or Negative
5
6
7
8
9
10
11
12
13
14
15
16
BEGIN
NUMBERnum
OUTPUT"Enter a Number"
OKUnum
IFnum>0THEN
OUTPUT"Entered number is positive"
ELSEIFnum<0THEN
OUTPUT"Entered number is negative"
ELSE
OUTPUT"Entered number is zero"
ENDIF
END

Pseudocode & FlowchartExample 6
Find the biggest of three (3) Numbers
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
BEGIN
NUMBERnum1,num2,num3
INPUTnum1
INPUTnum2
INPUTnum3
IFnum1>num2ANDnum1>num3THEN
OUTPUTnum1+ "is higher"
ELSEIFnum2> num3THEN
OUTPUTnum2+ "is higher"
ELSE
OUTPUTnum3+ "is higher"
ENDIF
END

Pseudocode & FlowchartExample 7
Print Numbers from 1 to 100
2
3
4
5
6
7
8
BEGIN
NUMBER counter
FORcounter= 1TO100STEP1DO
OUTPUUT counter
ENDFOR
END

Pseudocode & FlowchartExample 8
Read 50 numbers and find their sum
BEGIN
NUMBERcounter,sum=0,num
FORcounter=1TO50STEPcounterDO
OUTPUT"Enter a Number"
INPUTnum
sum=sum+num
ENDFOR
OUTPUTsum
END

Pseudocode & FlowchartExample 9
Read 10 numbers and find sum of even numbers
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
BEGIN
NUMBERcounter,sum=0,num
FORcounter=1TO10STEP1DO
OUTPUT"Entera Number"
INPUTnum
IFnum% 2== 0THEN
sum=sum+num
ENDIF
ENDFOR
OUTPUTsum
BİTİR

Pseudocode & FlowchartExample 10
Calculate the Square Root of a Number
BEGIN
NUMBERroot=1,counter=0,num
OUTPUT"Enter a number for calculate the root"
INPUTnum
WHILEsayac< sayi+1THEN
i=i+1
root=(num/root+root)/2
ENDWHILE
OUTPUTroot
END

csharp-console-examples.com
Formorepseudocodeve flowchart
examples
clickhere