SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Lecture 5Lecture 5
Version 1.0Version 1.0
Essentials of RepetitionEssentials of Repetition
The while loop structureThe while loop structure
Version 1.0Version 1.0
2Rushdi Shams, Dept of CSE, KUET, Bangladesh
RepetitionRepetition
 Most C programs involve in repetition orMost C programs involve in repetition or
loopinglooping
 AA looploop is ais a group of instructionsgroup of instructions the computerthe computer
executes while someexecutes while some loop continuationloop continuation
conditioncondition remainsremains truetrue
3Rushdi Shams, Dept of CSE, KUET, Bangladesh
Types of RepetitionTypes of Repetition
 1. Counter-controlled repetition1. Counter-controlled repetition
 2. Sentinel-controlled repetition2. Sentinel-controlled repetition
4Rushdi Shams, Dept of CSE, KUET, Bangladesh
Counter Controlled RepetitionCounter Controlled Repetition
 We know in advance exactly how many timesWe know in advance exactly how many times
the loop will be executedthe loop will be executed
 AA control variablecontrol variable is used to count the numberis used to count the number
of repetitionsof repetitions
 TheThe control variable iscontrol variable is
incremented/decrementedincremented/decremented each time theeach time the
group of instructions is performedgroup of instructions is performed
5Rushdi Shams, Dept of CSE, KUET, Bangladesh
Counter Controlled RepetitionCounter Controlled Repetition
 When theWhen the value of the control variablevalue of the control variable
indicates thatindicates that correct number of repetitionscorrect number of repetitions
has been performedhas been performed, the loop, the loop terminatesterminates
 The computer continues executingThe computer continues executing thethe
statement after the repetition structurestatement after the repetition structure
6Rushdi Shams, Dept of CSE, KUET, Bangladesh
Sentinel Controlled LoopSentinel Controlled Loop
 It is not known in advance how many times theIt is not known in advance how many times the
loop will be executedloop will be executed
 It is particularly useful when-It is particularly useful when-
 a. The precise number of repetition is nota. The precise number of repetition is not
known in advanceknown in advance
 b. The loop includes statements that obtainb. The loop includes statements that obtain
data each time the loop is performed.data each time the loop is performed.
7Rushdi Shams, Dept of CSE, KUET, Bangladesh
The while LoopThe while Loop
 The general form of while loop is-The general form of while loop is-
8Rushdi Shams, Dept of CSE, KUET, Bangladesh
ExampleExample
 The following program prints number 1 to 10 using aThe following program prints number 1 to 10 using a
while loopwhile loop
9Rushdi Shams, Dept of CSE, KUET, Bangladesh
Case Study 1Case Study 1
 The lecturer of CSE department will have toThe lecturer of CSE department will have to
count total number of passes and fails for hiscount total number of passes and fails for his
class after taking the final exam.class after taking the final exam.
 The program will tell how many students passedThe program will tell how many students passed
and how many failed.and how many failed.
 Moreover, if his class has number of passes overMoreover, if his class has number of passes over
80%, then we will call his class BEST.80%, then we will call his class BEST.
 Otherwise, we will ask him to try better nextOtherwise, we will ask him to try better next
time.time.
10Rushdi Shams, Dept of CSE, KUET, Bangladesh
Case Study 1Case Study 1
1. Input:1. Input:
 The input of the program will be pass/fail onlyThe input of the program will be pass/fail only
for each student.for each student.
 You will have to collect the number of studentsYou will have to collect the number of students
from the user.from the user.
 This number of students will be your loopThis number of students will be your loop
control variable.control variable.
11Rushdi Shams, Dept of CSE, KUET, Bangladesh
Case Study 1Case Study 1
2. Inside Loop:2. Inside Loop:
 Inside the loop, you will have to keep track ofInside the loop, you will have to keep track of
number of fail and number of pass based on thenumber of fail and number of pass based on the
input.input.
12Rushdi Shams, Dept of CSE, KUET, Bangladesh
Case Study 1Case Study 1
3. Output:3. Output:
 You will have to show number of passedYou will have to show number of passed
students and number of failed students.students and number of failed students.
 Also, you will have to see if the number ofAlso, you will have to see if the number of
passed students is 80% or higher.passed students is 80% or higher.
13Rushdi Shams, Dept of CSE, KUET, Bangladesh
Let’s Start Planning the ProgramLet’s Start Planning the Program
1. Variables1. Variables
 For holding number of students (will be used inFor holding number of students (will be used in
loop condition), number of pass, number of fail,loop condition), number of pass, number of fail,
loop counter, and the user input (pass/fail)loop counter, and the user input (pass/fail)
14Rushdi Shams, Dept of CSE, KUET, Bangladesh
Let’s Start Planning the ProgramLet’s Start Planning the Program
2. A loop2. A loop
 Inside of the loop, you will have to have anInside of the loop, you will have to have an
if/else structure (if passed then increase pass,if/else structure (if passed then increase pass,
else increase fail).else increase fail).
15Rushdi Shams, Dept of CSE, KUET, Bangladesh
Let’s Start Planning the ProgramLet’s Start Planning the Program
3. At the end of the loop3. At the end of the loop
 You will have to have another if/else structureYou will have to have another if/else structure
(if pass is above or equal to 80% it is the BEST(if pass is above or equal to 80% it is the BEST
class, else the teacher will be asked for betterclass, else the teacher will be asked for better
luck next time).luck next time).
16Rushdi Shams, Dept of CSE, KUET, Bangladesh
PseudocodePseudocode
17Rushdi Shams, Dept of CSE, KUET, Bangladesh
Case Study 2Case Study 2
 The user is teacher once again. The user will giveThe user is teacher once again. The user will give
the program- number of students. Then he willthe program- number of students. Then he will
provide their marks. In the end, the program willprovide their marks. In the end, the program will
respond with the average marks. The programrespond with the average marks. The program
can really help a teacher to understand the meritcan really help a teacher to understand the merit
of his class.of his class.

Weitere ähnliche Inhalte

Ähnlich wie Lec 05. While Loop

Lec 03. Arithmetic Operator / Relational Operator
Lec 03. Arithmetic Operator / Relational OperatorLec 03. Arithmetic Operator / Relational Operator
Lec 03. Arithmetic Operator / Relational Operator
Rushdi Shams
 
Lec 06. For Loop / Break / Continue
Lec 06. For Loop / Break / ContinueLec 06. For Loop / Break / Continue
Lec 06. For Loop / Break / Continue
Rushdi Shams
 
Lec 07. Do-While Loop / Switch
Lec 07. Do-While Loop / SwitchLec 07. Do-While Loop / Switch
Lec 07. Do-While Loop / Switch
Rushdi Shams
 
Lec 04. If-Else Statement / Increment and Decrement Operators
Lec 04. If-Else Statement / Increment and Decrement OperatorsLec 04. If-Else Statement / Increment and Decrement Operators
Lec 04. If-Else Statement / Increment and Decrement Operators
Rushdi Shams
 
262017 Printhttpscontent.ashford.eduprintAUBUS680.1.docx
262017 Printhttpscontent.ashford.eduprintAUBUS680.1.docx262017 Printhttpscontent.ashford.eduprintAUBUS680.1.docx
262017 Printhttpscontent.ashford.eduprintAUBUS680.1.docx
tamicawaysmith
 

Ähnlich wie Lec 05. While Loop (20)

Lec 03. Arithmetic Operator / Relational Operator
Lec 03. Arithmetic Operator / Relational OperatorLec 03. Arithmetic Operator / Relational Operator
Lec 03. Arithmetic Operator / Relational Operator
 
Lec 06. For Loop / Break / Continue
Lec 06. For Loop / Break / ContinueLec 06. For Loop / Break / Continue
Lec 06. For Loop / Break / Continue
 
Lec 07. Do-While Loop / Switch
Lec 07. Do-While Loop / SwitchLec 07. Do-While Loop / Switch
Lec 07. Do-While Loop / Switch
 
Lec 04. If-Else Statement / Increment and Decrement Operators
Lec 04. If-Else Statement / Increment and Decrement OperatorsLec 04. If-Else Statement / Increment and Decrement Operators
Lec 04. If-Else Statement / Increment and Decrement Operators
 
Testing
TestingTesting
Testing
 
CMIS 102 HANDS-ON LAB WEEK 6 OVERVIEW THIS HANDS-ON LAB ALLOWS YOU TO FOLLOW ...
CMIS 102 HANDS-ON LAB WEEK 6 OVERVIEW THIS HANDS-ON LAB ALLOWS YOU TO FOLLOW ...CMIS 102 HANDS-ON LAB WEEK 6 OVERVIEW THIS HANDS-ON LAB ALLOWS YOU TO FOLLOW ...
CMIS 102 HANDS-ON LAB WEEK 6 OVERVIEW THIS HANDS-ON LAB ALLOWS YOU TO FOLLOW ...
 
Time Table Management system
Time Table Management systemTime Table Management system
Time Table Management system
 
Loops in c
Loops in cLoops in c
Loops in c
 
Muwanika rogers (software testing) muni university
Muwanika rogers (software testing) muni universityMuwanika rogers (software testing) muni university
Muwanika rogers (software testing) muni university
 
262017 Printhttpscontent.ashford.eduprintAUBUS680.1.docx
262017 Printhttpscontent.ashford.eduprintAUBUS680.1.docx262017 Printhttpscontent.ashford.eduprintAUBUS680.1.docx
262017 Printhttpscontent.ashford.eduprintAUBUS680.1.docx
 
TD Learning Webinar
TD Learning WebinarTD Learning Webinar
TD Learning Webinar
 
Fundamental of Information Technology - UNIT 8
Fundamental of Information Technology - UNIT 8Fundamental of Information Technology - UNIT 8
Fundamental of Information Technology - UNIT 8
 
Conditional statements & Loops
Conditional statements & LoopsConditional statements & Loops
Conditional statements & Loops
 
Visual studio alm 2012 reporting overview
Visual studio alm 2012   reporting overviewVisual studio alm 2012   reporting overview
Visual studio alm 2012 reporting overview
 
project report face recognition attendance system
project report face recognition attendance systemproject report face recognition attendance system
project report face recognition attendance system
 
C++ unit-1-part-14
C++ unit-1-part-14C++ unit-1-part-14
C++ unit-1-part-14
 
Latest Manual Testing Interview Questions and Answers 2015 - H2kinfosys
Latest Manual Testing Interview Questions and Answers 2015 - H2kinfosys Latest Manual Testing Interview Questions and Answers 2015 - H2kinfosys
Latest Manual Testing Interview Questions and Answers 2015 - H2kinfosys
 
Java chapter 3
Java chapter 3Java chapter 3
Java chapter 3
 
Unit2 for st
Unit2 for stUnit2 for st
Unit2 for st
 
Software Testing Metrics
Software Testing MetricsSoftware Testing Metrics
Software Testing Metrics
 

Mehr von Rushdi Shams

Types of machine translation
Types of machine translationTypes of machine translation
Types of machine translation
Rushdi Shams
 
L1 l2 l3 introduction to machine translation
L1 l2 l3  introduction to machine translationL1 l2 l3  introduction to machine translation
L1 l2 l3 introduction to machine translation
Rushdi Shams
 
Syntax and semantics
Syntax and semanticsSyntax and semantics
Syntax and semantics
Rushdi Shams
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
Rushdi Shams
 
Probabilistic logic
Probabilistic logicProbabilistic logic
Probabilistic logic
Rushdi Shams
 
Knowledge structure
Knowledge structureKnowledge structure
Knowledge structure
Rushdi Shams
 
Knowledge representation
Knowledge representationKnowledge representation
Knowledge representation
Rushdi Shams
 
L5 understanding hacking
L5  understanding hackingL5  understanding hacking
L5 understanding hacking
Rushdi Shams
 
L2 Intrusion Detection System (IDS)
L2  Intrusion Detection System (IDS)L2  Intrusion Detection System (IDS)
L2 Intrusion Detection System (IDS)
Rushdi Shams
 
L2 l3 l4 software process models
L2 l3 l4  software process modelsL2 l3 l4  software process models
L2 l3 l4 software process models
Rushdi Shams
 

Mehr von Rushdi Shams (20)

Research Methodology and Tips on Better Research
Research Methodology and Tips on Better ResearchResearch Methodology and Tips on Better Research
Research Methodology and Tips on Better Research
 
Common evaluation measures in NLP and IR
Common evaluation measures in NLP and IRCommon evaluation measures in NLP and IR
Common evaluation measures in NLP and IR
 
Machine learning with nlp 101
Machine learning with nlp 101Machine learning with nlp 101
Machine learning with nlp 101
 
Semi-supervised classification for natural language processing
Semi-supervised classification for natural language processingSemi-supervised classification for natural language processing
Semi-supervised classification for natural language processing
 
Natural Language Processing: Parsing
Natural Language Processing: ParsingNatural Language Processing: Parsing
Natural Language Processing: Parsing
 
Types of machine translation
Types of machine translationTypes of machine translation
Types of machine translation
 
L1 l2 l3 introduction to machine translation
L1 l2 l3  introduction to machine translationL1 l2 l3  introduction to machine translation
L1 l2 l3 introduction to machine translation
 
Syntax and semantics
Syntax and semanticsSyntax and semantics
Syntax and semantics
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Probabilistic logic
Probabilistic logicProbabilistic logic
Probabilistic logic
 
L15 fuzzy logic
L15  fuzzy logicL15  fuzzy logic
L15 fuzzy logic
 
Knowledge structure
Knowledge structureKnowledge structure
Knowledge structure
 
Knowledge representation
Knowledge representationKnowledge representation
Knowledge representation
 
First order logic
First order logicFirst order logic
First order logic
 
Belief function
Belief functionBelief function
Belief function
 
L5 understanding hacking
L5  understanding hackingL5  understanding hacking
L5 understanding hacking
 
L3 defense
L3  defenseL3  defense
L3 defense
 
L2 Intrusion Detection System (IDS)
L2  Intrusion Detection System (IDS)L2  Intrusion Detection System (IDS)
L2 Intrusion Detection System (IDS)
 
L1 phishing
L1  phishingL1  phishing
L1 phishing
 
L2 l3 l4 software process models
L2 l3 l4  software process modelsL2 l3 l4  software process models
L2 l3 l4 software process models
 

Kürzlich hochgeladen

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 

Kürzlich hochgeladen (20)

Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 

Lec 05. While Loop

  • 1. Lecture 5Lecture 5 Version 1.0Version 1.0 Essentials of RepetitionEssentials of Repetition The while loop structureThe while loop structure Version 1.0Version 1.0
  • 2. 2Rushdi Shams, Dept of CSE, KUET, Bangladesh RepetitionRepetition  Most C programs involve in repetition orMost C programs involve in repetition or loopinglooping  AA looploop is ais a group of instructionsgroup of instructions the computerthe computer executes while someexecutes while some loop continuationloop continuation conditioncondition remainsremains truetrue
  • 3. 3Rushdi Shams, Dept of CSE, KUET, Bangladesh Types of RepetitionTypes of Repetition  1. Counter-controlled repetition1. Counter-controlled repetition  2. Sentinel-controlled repetition2. Sentinel-controlled repetition
  • 4. 4Rushdi Shams, Dept of CSE, KUET, Bangladesh Counter Controlled RepetitionCounter Controlled Repetition  We know in advance exactly how many timesWe know in advance exactly how many times the loop will be executedthe loop will be executed  AA control variablecontrol variable is used to count the numberis used to count the number of repetitionsof repetitions  TheThe control variable iscontrol variable is incremented/decrementedincremented/decremented each time theeach time the group of instructions is performedgroup of instructions is performed
  • 5. 5Rushdi Shams, Dept of CSE, KUET, Bangladesh Counter Controlled RepetitionCounter Controlled Repetition  When theWhen the value of the control variablevalue of the control variable indicates thatindicates that correct number of repetitionscorrect number of repetitions has been performedhas been performed, the loop, the loop terminatesterminates  The computer continues executingThe computer continues executing thethe statement after the repetition structurestatement after the repetition structure
  • 6. 6Rushdi Shams, Dept of CSE, KUET, Bangladesh Sentinel Controlled LoopSentinel Controlled Loop  It is not known in advance how many times theIt is not known in advance how many times the loop will be executedloop will be executed  It is particularly useful when-It is particularly useful when-  a. The precise number of repetition is nota. The precise number of repetition is not known in advanceknown in advance  b. The loop includes statements that obtainb. The loop includes statements that obtain data each time the loop is performed.data each time the loop is performed.
  • 7. 7Rushdi Shams, Dept of CSE, KUET, Bangladesh The while LoopThe while Loop  The general form of while loop is-The general form of while loop is-
  • 8. 8Rushdi Shams, Dept of CSE, KUET, Bangladesh ExampleExample  The following program prints number 1 to 10 using aThe following program prints number 1 to 10 using a while loopwhile loop
  • 9. 9Rushdi Shams, Dept of CSE, KUET, Bangladesh Case Study 1Case Study 1  The lecturer of CSE department will have toThe lecturer of CSE department will have to count total number of passes and fails for hiscount total number of passes and fails for his class after taking the final exam.class after taking the final exam.  The program will tell how many students passedThe program will tell how many students passed and how many failed.and how many failed.  Moreover, if his class has number of passes overMoreover, if his class has number of passes over 80%, then we will call his class BEST.80%, then we will call his class BEST.  Otherwise, we will ask him to try better nextOtherwise, we will ask him to try better next time.time.
  • 10. 10Rushdi Shams, Dept of CSE, KUET, Bangladesh Case Study 1Case Study 1 1. Input:1. Input:  The input of the program will be pass/fail onlyThe input of the program will be pass/fail only for each student.for each student.  You will have to collect the number of studentsYou will have to collect the number of students from the user.from the user.  This number of students will be your loopThis number of students will be your loop control variable.control variable.
  • 11. 11Rushdi Shams, Dept of CSE, KUET, Bangladesh Case Study 1Case Study 1 2. Inside Loop:2. Inside Loop:  Inside the loop, you will have to keep track ofInside the loop, you will have to keep track of number of fail and number of pass based on thenumber of fail and number of pass based on the input.input.
  • 12. 12Rushdi Shams, Dept of CSE, KUET, Bangladesh Case Study 1Case Study 1 3. Output:3. Output:  You will have to show number of passedYou will have to show number of passed students and number of failed students.students and number of failed students.  Also, you will have to see if the number ofAlso, you will have to see if the number of passed students is 80% or higher.passed students is 80% or higher.
  • 13. 13Rushdi Shams, Dept of CSE, KUET, Bangladesh Let’s Start Planning the ProgramLet’s Start Planning the Program 1. Variables1. Variables  For holding number of students (will be used inFor holding number of students (will be used in loop condition), number of pass, number of fail,loop condition), number of pass, number of fail, loop counter, and the user input (pass/fail)loop counter, and the user input (pass/fail)
  • 14. 14Rushdi Shams, Dept of CSE, KUET, Bangladesh Let’s Start Planning the ProgramLet’s Start Planning the Program 2. A loop2. A loop  Inside of the loop, you will have to have anInside of the loop, you will have to have an if/else structure (if passed then increase pass,if/else structure (if passed then increase pass, else increase fail).else increase fail).
  • 15. 15Rushdi Shams, Dept of CSE, KUET, Bangladesh Let’s Start Planning the ProgramLet’s Start Planning the Program 3. At the end of the loop3. At the end of the loop  You will have to have another if/else structureYou will have to have another if/else structure (if pass is above or equal to 80% it is the BEST(if pass is above or equal to 80% it is the BEST class, else the teacher will be asked for betterclass, else the teacher will be asked for better luck next time).luck next time).
  • 16. 16Rushdi Shams, Dept of CSE, KUET, Bangladesh PseudocodePseudocode
  • 17. 17Rushdi Shams, Dept of CSE, KUET, Bangladesh Case Study 2Case Study 2  The user is teacher once again. The user will giveThe user is teacher once again. The user will give the program- number of students. Then he willthe program- number of students. Then he will provide their marks. In the end, the program willprovide their marks. In the end, the program will respond with the average marks. The programrespond with the average marks. The program can really help a teacher to understand the meritcan really help a teacher to understand the merit of his class.of his class.