SlideShare a Scribd company logo
1 of 23
C
PSEUDOCODE & FLOWCHART
EXAMPLES
10 EXAMPLES
p -
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.
Pseudecode
• INPUT – indicates a user will be inputting something
• OUTPUT – indicates that an output will appear on the screen
• WHILE – a loop (iteration that has a condition at 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 & Flowchart
1
2
3
4
5
6
7
8
9
BEGIN
NUMBER s1, s2, sum
OUTPUT("Input number1:")
INPUT s1
OUTPUT("Input number2:")
INPUT s2
sum=s1+s2
OUTPUT sum
END
Pseudocode & Flowchart
Example 1 Add Two Numbers
Pseudocode & Flowchart
1
2
3
4
5
6
7
8
9
BEGIN
NUMBER b1,b2,area,perimeter
INPUT b1
UNPUT b2
area=b1*b2
perimeter=2*(b1+b2)
OUTPUT alan
OUTPUT perimeter
END
Pseudocode & Flowchart
Example 2
Pseudocode & Flowchart
Calculate Perimeter of Rectangle
Pseudocode & Flowchart
Example 3
Find Perimeter Of Circle using Radius
Pseudocode & Flowchart
2
3
4
5
6
BEGIN
NUMBER r, perimeter
INPUT r
area=3.14*2*r
OUTPUT perimeter
END
Pseudocode & Flowchart Example 4
Calculate sales taxes
3
4
5
6
7
8
9
10
11
12
13
14
15
BEGIN
NUMBER price, tax, taxRate, total
OUTPUT "Enter Product Price"
INPUT price
OUTPUT "Enter tax rate amoung 1 and 100"
OKU taxRate
tax= price* taxRate/100
total= price + tax
OUTPUT "Product tax="+tax
OUTPUT "Product total price ="+total
END
Pseudocode & Flowchart Example 5
Check a Number is Positive or Negative
5
6
7
8
9
10
11
12
13
14
15
16
BEGIN
NUMBER num
OUTPUT "Enter a Number"
OKU num
IF num>0 THEN
OUTPUT "Entered number is positive"
ELSE IF num <0 THEN
OUTPUT "Entered number is negative"
ELSE
OUTPUT "Entered number is zero"
ENDIF
END
Pseudocode & Flowchart Example 6
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
BEGIN
NUMBER num1,num2,num3
INPUT num1
INPUT num2
INPUT num3
IF num1>num2 AND num1>num3 THEN
OUTPUT num1+ "is higher"
ELSE IF num2 > num3 THEN OUTPUT
num2 + "is higher"
ELSE
OUTPUT num3+ "is higher"
ENDIF
END
Pseudocode & Flowchart Example 7
Find the biggest of three (3)
Pseudocode & Flowchart Example 8
Numbers
Pseudocode & Flowchart Example 9
Print Numbers from 1 to 100
2
3
4
5
6
7
8
BEGIN
NUMBER counter
FOR counter = 1 TO 100 STEP 1 DO
OUTPUUT counter ENDFOR
END
Pseudocode & Flowchart Example 10
Read 50 numbers and find their sum
Pseudocode & Flowchart Example 11
BEGIN
NUMBER counter, sum=0, num
FOR counter=1 TO 50 STEP counter DO
OUTPUT "Enter a Number" INPUT num sum=sum+num ENDFOR
OUTPUT sum
END
Pseudocode & Flowchart Example 12
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
BEGIN
NUMBER counter, sum=0, num
FOR counter=1 TO 10 STEP 1 DO
OUTPUT "Enter a Number"
INPUT num
IF num % 2 == 0 THEN
sum=sum+num ENDIF
ENDFOR
OUTPUT sum
BİTİR
Pseudocode & Flowchart Example 13
Read 10 numbers and find sum of even
Pseudocode & Flowchart Example 14
numbers
Pseudocode & Flowchart Example 15
Calculate the Square Root of a Number
BEGIN
NUMBER root=1, counter=0,num
OUTPUT "Enter a number for calculate the root"
INPUT num
WHILE sayac < sayi+1 THEN i=i+1
root=(num/root+root)/2
END WHILE
OUTPUT root END
csharp-console-examples.com
For more pseudocode ve flowchart
examples click here

More Related Content

Similar to 8234.docx

12-Lec - Repetition For Loop.pptx
12-Lec - Repetition For Loop.pptx12-Lec - Repetition For Loop.pptx
12-Lec - Repetition For Loop.pptx
AqeelAbbas94
 

Similar to 8234.docx (20)

12 lec 12 loop
12 lec 12 loop 12 lec 12 loop
12 lec 12 loop
 
MUST CS101 Lab11
MUST CS101 Lab11 MUST CS101 Lab11
MUST CS101 Lab11
 
12-Lec - Repetition For Loop.pptx
12-Lec - Repetition For Loop.pptx12-Lec - Repetition For Loop.pptx
12-Lec - Repetition For Loop.pptx
 
Control structure of c
Control structure of cControl structure of c
Control structure of c
 
Cse115 lecture08repetitionstructures part02
Cse115 lecture08repetitionstructures part02Cse115 lecture08repetitionstructures part02
Cse115 lecture08repetitionstructures part02
 
Loops
LoopsLoops
Loops
 
C C++ tutorial for beginners- tibacademy.in
C C++ tutorial for beginners- tibacademy.inC C++ tutorial for beginners- tibacademy.in
C C++ tutorial for beginners- tibacademy.in
 
Pseudocode
PseudocodePseudocode
Pseudocode
 
Algorithm and psuedocode
Algorithm and psuedocodeAlgorithm and psuedocode
Algorithm and psuedocode
 
Matlab Script - Loop Control
Matlab Script - Loop ControlMatlab Script - Loop Control
Matlab Script - Loop Control
 
Loops in Python.pptx
Loops in Python.pptxLoops in Python.pptx
Loops in Python.pptx
 
Workbook_2_Problem_Solving_and_programming.pdf
Workbook_2_Problem_Solving_and_programming.pdfWorkbook_2_Problem_Solving_and_programming.pdf
Workbook_2_Problem_Solving_and_programming.pdf
 
Algorithms
AlgorithmsAlgorithms
Algorithms
 
Electronz_Chapter_12.pptx
Electronz_Chapter_12.pptxElectronz_Chapter_12.pptx
Electronz_Chapter_12.pptx
 
List Processing in ABAP
List Processing in ABAPList Processing in ABAP
List Processing in ABAP
 
Week2 ch4 part1edited 2020
Week2 ch4 part1edited 2020Week2 ch4 part1edited 2020
Week2 ch4 part1edited 2020
 
Week2 ch4 part1edited 2020
Week2 ch4 part1edited 2020Week2 ch4 part1edited 2020
Week2 ch4 part1edited 2020
 
Decision making and branching
Decision making and branchingDecision making and branching
Decision making and branching
 
Bikalpa_Thapa_Python_Programming_(Basics).pptx
Bikalpa_Thapa_Python_Programming_(Basics).pptxBikalpa_Thapa_Python_Programming_(Basics).pptx
Bikalpa_Thapa_Python_Programming_(Basics).pptx
 
Hargun
HargunHargun
Hargun
 

Recently uploaded

Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 

Recently uploaded (20)

MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 

8234.docx

  • 2. 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.
  • 3. Pseudecode • INPUT – indicates a user will be inputting something • OUTPUT – indicates that an output will appear on the screen • WHILE – a loop (iteration that has a condition at 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
  • 4. Pseudocode & Flowchart 1 2 3 4 5 6 7 8 9 BEGIN NUMBER s1, s2, sum OUTPUT("Input number1:") INPUT s1 OUTPUT("Input number2:") INPUT s2 sum=s1+s2 OUTPUT sum END
  • 5. Pseudocode & Flowchart Example 1 Add Two Numbers
  • 6. Pseudocode & Flowchart 1 2 3 4 5 6 7 8 9 BEGIN NUMBER b1,b2,area,perimeter INPUT b1 UNPUT b2 area=b1*b2 perimeter=2*(b1+b2) OUTPUT alan OUTPUT perimeter END
  • 8. Pseudocode & Flowchart Calculate Perimeter of Rectangle
  • 9. Pseudocode & Flowchart Example 3 Find Perimeter Of Circle using Radius
  • 10. Pseudocode & Flowchart 2 3 4 5 6 BEGIN NUMBER r, perimeter INPUT r area=3.14*2*r OUTPUT perimeter END
  • 11. Pseudocode & Flowchart Example 4 Calculate sales taxes 3 4 5 6 7 8 9 10 11 12 13 14 15 BEGIN NUMBER price, tax, taxRate, total OUTPUT "Enter Product Price" INPUT price OUTPUT "Enter tax rate amoung 1 and 100" OKU taxRate tax= price* taxRate/100 total= price + tax OUTPUT "Product tax="+tax OUTPUT "Product total price ="+total END
  • 12. Pseudocode & Flowchart Example 5 Check a Number is Positive or Negative 5 6 7 8 9 10 11 12 13 14 15 16 BEGIN NUMBER num OUTPUT "Enter a Number" OKU num IF num>0 THEN OUTPUT "Entered number is positive" ELSE IF num <0 THEN OUTPUT "Entered number is negative" ELSE OUTPUT "Entered number is zero" ENDIF END
  • 13. Pseudocode & Flowchart Example 6 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 BEGIN NUMBER num1,num2,num3 INPUT num1 INPUT num2 INPUT num3 IF num1>num2 AND num1>num3 THEN OUTPUT num1+ "is higher" ELSE IF num2 > num3 THEN OUTPUT num2 + "is higher" ELSE OUTPUT num3+ "is higher" ENDIF END
  • 14. Pseudocode & Flowchart Example 7 Find the biggest of three (3)
  • 15. Pseudocode & Flowchart Example 8 Numbers
  • 16. Pseudocode & Flowchart Example 9 Print Numbers from 1 to 100 2 3 4 5 6 7 8 BEGIN NUMBER counter FOR counter = 1 TO 100 STEP 1 DO OUTPUUT counter ENDFOR END
  • 17. Pseudocode & Flowchart Example 10 Read 50 numbers and find their sum
  • 18. Pseudocode & Flowchart Example 11 BEGIN NUMBER counter, sum=0, num FOR counter=1 TO 50 STEP counter DO OUTPUT "Enter a Number" INPUT num sum=sum+num ENDFOR OUTPUT sum END
  • 19. Pseudocode & Flowchart Example 12 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 BEGIN NUMBER counter, sum=0, num FOR counter=1 TO 10 STEP 1 DO OUTPUT "Enter a Number" INPUT num IF num % 2 == 0 THEN sum=sum+num ENDIF ENDFOR OUTPUT sum BİTİR
  • 20. Pseudocode & Flowchart Example 13 Read 10 numbers and find sum of even
  • 21. Pseudocode & Flowchart Example 14 numbers
  • 22. Pseudocode & Flowchart Example 15 Calculate the Square Root of a Number BEGIN NUMBER root=1, counter=0,num OUTPUT "Enter a number for calculate the root" INPUT num WHILE sayac < sayi+1 THEN i=i+1 root=(num/root+root)/2 END WHILE OUTPUT root END
  • 23. csharp-console-examples.com For more pseudocode ve flowchart examples click here