SlideShare a Scribd company logo
Instructor : Muhammad HarisAll Rights Reserved to Department of Computer Science – GCU Lahore
Programming Fundamentals
Consider this Example
 Determine status of a Student from
marks of two of his subjects and his
GPA
If either the marks for both of the subjects
are greater than 40 or GPA is greater than
2, he’s considered passed
Programming Fundamentals | Lecture-5 2
Programming Fundamentals | Lecture-5 3
START
READ m1, m2, GPA
DISPLAY “Passed”
STOP
(m1 > 40 AND m2 > 40)
OR GPA > 2
YesNo
DISPLAY “Failed”
Another Example
 Determine whether a student has got
Grade A from his total marks and his
GPA
If marks are greater than 80 and less than
90 OR GPA is greater than 3.7 and less 3.8,
he will be graded as “A”
Programming Fundamentals | Lecture-5 4
Programming Fundamentals | Lecture-5 5
START
READ tm, GPA
DISPLAY “A”
STOP
(tm > 80 AND tm < 90)
OR
(GPA > 3.7 AND GPA < 3.8)
YesNo
DISPLAY “Other than A”
Try this Yourself
 Determine whether a car is of mid-size
type or not from its price (in millions) and
engine capacity (in cc)
If price is between 1 million and 2 million or
if engine capacity is between 1000 and
1500, a car is considered to be a mid-size
car
Programming Fundamentals | Lecture-5 6
Programming Fundamentals | Lecture-5 7
Decision Box Yes No
> > <=
< < >=
== == !=
!= != ==
<= <= >
>= >= <
Operator Opposite
> <=
< >=
== !=
!= ==
<= >
>= <
Decision leading to Decisions
 In real-world problems, it frequently
happens that result of a decision leads
to further decision making
 This way computer programs prove to
be much more useful
Programming Fundamentals | Lecture-5 8
Consider this Example
 For two numbers, do the following
If second number is greater than 0
○ Divide them
If second number is less than 0
○ Multiply them
If second number is equal to 0
○ Add them
Programming Fundamentals | Lecture-5 9
Programming Fundamentals | Lecture-5 10
START
READ num1, num2
DISPLAY ans
STOP
ans = num1 / num2
num2 > 0
YesNo
num2 < 0
ans = num1 * num2ans = num1 +num2
<= >
Yes
<
No
==
Another Example
 For given roll number of a student,
display his name
Assume that there are only three students
(first three roll numbers of your section)
Programming Fundamentals | Lecture-5 11
Programming Fundamentals | Lecture-5 12
START
READ rollNo
DISPLAY “Ali”
STOP
rollNo == 2
YesNo
!= ==
Yes
<No
rollNo == 4
rollNo == 8
DISPLAY
“Rehman”
DISPLAY
“Hassan”
DISPLAY “No
Such Student”
YesNo
Try this Yourself
 For given day number of the week,
display the corresponding day
Programming Fundamentals | Lecture-5 13
Day Number Week Day
1 Monday
2 Tuesday
3 Wednesday
4 Thursday
Tasks (to be done by next lecture)
 Display the name of a city against given
city code
Design your solution for 4-5 cities only
 Calculate base pay from given annual
salary and pay type
Base pay = salary / Dividing Factor
Programming Fundamentals | Lecture-5 14
Pay type Description Dividing Factor
1 Weekly 52
2 Bi-monthly 24
3 Monthly 12
Programming Fundamentals | Lecture-5 15
BE PREPARED
FOR
QUIZ
IN
NEXT LECTURE

More Related Content

What's hot

Flowcharts and pseudocodes
Flowcharts and pseudocodesFlowcharts and pseudocodes
Flowcharts and pseudocodes
Dr Piyush Charan
 
Introduction to problem solving in C
Introduction to problem solving in CIntroduction to problem solving in C
Introduction to problem solving in C
Diwakar Pratap Singh 'Deva'
 
Cs 1114 - lecture-5
Cs 1114 - lecture-5Cs 1114 - lecture-5
Cs 1114 - lecture-5
Zeeshan Sabir
 
2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem
Frankie Jones
 
Class 7 lecture notes
Class 7 lecture notesClass 7 lecture notes
Class 7 lecture notes
Stephen Parsons
 
Problem solving using Computer
Problem solving using ComputerProblem solving using Computer
Problem solving using Computer
David Livingston J
 
1 introduction to problem solving and programming
1 introduction to problem solving and programming1 introduction to problem solving and programming
1 introduction to problem solving and programming
Rheigh Henley Calderon
 
Fundamentals of programming)
Fundamentals of programming)Fundamentals of programming)
Fundamentals of programming)
jakejakejake2
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
Ashesh R
 
Data structures & problem solving unit 1 ppt
Data structures & problem solving unit 1 pptData structures & problem solving unit 1 ppt
Data structures & problem solving unit 1 ppt
aviban
 
Problem solving (C++ Programming)
Problem solving (C++ Programming)Problem solving (C++ Programming)
Problem solving (C++ Programming)
Umair Younas
 
Algorithm &amp; flowchart
Algorithm &amp; flowchartAlgorithm &amp; flowchart
Algorithm &amp; flowchart
saurabh sen sky
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
Elizabeth de Leon Aler
 
Flowchart and algorithem
Flowchart and algorithemFlowchart and algorithem
Flowchart and algorithem
ehsanullah786
 
An introduction to Competitive Programming
An introduction to Competitive ProgrammingAn introduction to Competitive Programming
An introduction to Competitive Programming
Gaurav Agarwal
 
03 algorithm properties
03 algorithm properties03 algorithm properties
03 algorithm properties
Lincoln School
 
Dynamic programming 2
Dynamic programming 2Dynamic programming 2
Dynamic programming 2
Roy Thomas
 
Competitive Programming Guide
Competitive Programming GuideCompetitive Programming Guide
Competitive Programming Guide
Ajay Khatri
 
Algorithm and flowchart2010
Algorithm and flowchart2010Algorithm and flowchart2010
Algorithm and flowchart2010
Jordan Delacruz
 
Lesson 3
Lesson 3Lesson 3

What's hot (20)

Flowcharts and pseudocodes
Flowcharts and pseudocodesFlowcharts and pseudocodes
Flowcharts and pseudocodes
 
Introduction to problem solving in C
Introduction to problem solving in CIntroduction to problem solving in C
Introduction to problem solving in C
 
Cs 1114 - lecture-5
Cs 1114 - lecture-5Cs 1114 - lecture-5
Cs 1114 - lecture-5
 
2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem
 
Class 7 lecture notes
Class 7 lecture notesClass 7 lecture notes
Class 7 lecture notes
 
Problem solving using Computer
Problem solving using ComputerProblem solving using Computer
Problem solving using Computer
 
1 introduction to problem solving and programming
1 introduction to problem solving and programming1 introduction to problem solving and programming
1 introduction to problem solving and programming
 
Fundamentals of programming)
Fundamentals of programming)Fundamentals of programming)
Fundamentals of programming)
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
 
Data structures & problem solving unit 1 ppt
Data structures & problem solving unit 1 pptData structures & problem solving unit 1 ppt
Data structures & problem solving unit 1 ppt
 
Problem solving (C++ Programming)
Problem solving (C++ Programming)Problem solving (C++ Programming)
Problem solving (C++ Programming)
 
Algorithm &amp; flowchart
Algorithm &amp; flowchartAlgorithm &amp; flowchart
Algorithm &amp; flowchart
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Flowchart and algorithem
Flowchart and algorithemFlowchart and algorithem
Flowchart and algorithem
 
An introduction to Competitive Programming
An introduction to Competitive ProgrammingAn introduction to Competitive Programming
An introduction to Competitive Programming
 
03 algorithm properties
03 algorithm properties03 algorithm properties
03 algorithm properties
 
Dynamic programming 2
Dynamic programming 2Dynamic programming 2
Dynamic programming 2
 
Competitive Programming Guide
Competitive Programming GuideCompetitive Programming Guide
Competitive Programming Guide
 
Algorithm and flowchart2010
Algorithm and flowchart2010Algorithm and flowchart2010
Algorithm and flowchart2010
 
Lesson 3
Lesson 3Lesson 3
Lesson 3
 

Viewers also liked

Programming fundamentals lecture 4
Programming fundamentals lecture 4Programming fundamentals lecture 4
Programming fundamentals lecture 4
Raja Hamid
 
Fundamental Programming Lect 1
Fundamental Programming Lect 1Fundamental Programming Lect 1
Fundamental Programming Lect 1
Namrah Erum
 
Computer programs, flow chart & algorithm
Computer programs, flow chart & algorithmComputer programs, flow chart & algorithm
Computer programs, flow chart & algorithm
samina khan
 
Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2
Raja Hamid
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
Tareq Hasan
 
Functional Programming Fundamentals
Functional Programming FundamentalsFunctional Programming Fundamentals
Functional Programming Fundamentals
Shahriar Hyder
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles
Intro C# Book
 
C++ ppt
C++ pptC++ ppt
C++ ppt
parpan34
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
Ahmad Idrees
 

Viewers also liked (9)

Programming fundamentals lecture 4
Programming fundamentals lecture 4Programming fundamentals lecture 4
Programming fundamentals lecture 4
 
Fundamental Programming Lect 1
Fundamental Programming Lect 1Fundamental Programming Lect 1
Fundamental Programming Lect 1
 
Computer programs, flow chart & algorithm
Computer programs, flow chart & algorithmComputer programs, flow chart & algorithm
Computer programs, flow chart & algorithm
 
Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
 
Functional Programming Fundamentals
Functional Programming FundamentalsFunctional Programming Fundamentals
Functional Programming Fundamentals
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles
 
C++ ppt
C++ pptC++ ppt
C++ ppt
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 

Similar to Fundamental Programming Lect 5

Cs 1114 - lecture-7
Cs 1114 - lecture-7Cs 1114 - lecture-7
Cs 1114 - lecture-7
Zeeshan Sabir
 
Cs 1114 - lecture-4
Cs 1114 - lecture-4Cs 1114 - lecture-4
Cs 1114 - lecture-4
Zeeshan Sabir
 
Cs 1114 - lecture-6
Cs 1114 - lecture-6Cs 1114 - lecture-6
Cs 1114 - lecture-6
Zeeshan Sabir
 
Programming algorithms and flowchart.ppt
Programming algorithms and flowchart.pptProgramming algorithms and flowchart.ppt
Programming algorithms and flowchart.ppt
VictorMorcillo1
 
Cs 1114 - lecture-10
Cs 1114 - lecture-10Cs 1114 - lecture-10
Cs 1114 - lecture-10
Zeeshan Sabir
 
presentation_python_11_1569171345_375360.pptx
presentation_python_11_1569171345_375360.pptxpresentation_python_11_1569171345_375360.pptx
presentation_python_11_1569171345_375360.pptx
GAURAVRATHORE86
 
Cs 1114 - lecture-9
Cs 1114 - lecture-9Cs 1114 - lecture-9
Cs 1114 - lecture-9
Zeeshan Sabir
 
Mb0048 operations research
Mb0048 operations researchMb0048 operations research
Mb0048 operations research
smumbahelp
 
Copy of dti2143/dam31303 chap 1 problem solving and program design
Copy of dti2143/dam31303 chap 1 problem solving and program designCopy of dti2143/dam31303 chap 1 problem solving and program design
Copy of dti2143/dam31303 chap 1 problem solving and program design
alish sha
 
Cs 1114 - lecture-8
Cs 1114 - lecture-8Cs 1114 - lecture-8
Cs 1114 - lecture-8
Zeeshan Sabir
 
28_09_2018 eMadrid seminar on MOOCs by Ralf Teusner, Hasso Plattner Institute...
28_09_2018 eMadrid seminar on MOOCs by Ralf Teusner, Hasso Plattner Institute...28_09_2018 eMadrid seminar on MOOCs by Ralf Teusner, Hasso Plattner Institute...
28_09_2018 eMadrid seminar on MOOCs by Ralf Teusner, Hasso Plattner Institute...
eMadrid network
 
15 min guide to gmat (1)
15 min guide to gmat (1)15 min guide to gmat (1)
15 min guide to gmat (1)
gurleen kaur
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
Sachin Goyani
 
Metode Perancangan Program #2 Selection and Repetition Control Structure-ITSB...
Metode Perancangan Program #2 Selection and Repetition Control Structure-ITSB...Metode Perancangan Program #2 Selection and Repetition Control Structure-ITSB...
Metode Perancangan Program #2 Selection and Repetition Control Structure-ITSB...
ronistgdr
 
Test case design_the_basicsv0.4
Test case design_the_basicsv0.4Test case design_the_basicsv0.4
Test case design_the_basicsv0.4
guest31fced
 
Covidien Dc Work Keys 101 2
Covidien Dc    Work Keys 101 2Covidien Dc    Work Keys 101 2
Covidien Dc Work Keys 101 2
LauraAtACT
 
Lab 6 sem ii_11_12
Lab 6 sem ii_11_12Lab 6 sem ii_11_12
Lab 6 sem ii_11_12
alish sha
 
Algorithm & flow chart
Algorithm & flow chartAlgorithm & flow chart
The gmat-unlocked
The gmat-unlockedThe gmat-unlocked
The gmat-unlocked
Rushabh Vora
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box Testing
Nivetha Padmanaban
 

Similar to Fundamental Programming Lect 5 (20)

Cs 1114 - lecture-7
Cs 1114 - lecture-7Cs 1114 - lecture-7
Cs 1114 - lecture-7
 
Cs 1114 - lecture-4
Cs 1114 - lecture-4Cs 1114 - lecture-4
Cs 1114 - lecture-4
 
Cs 1114 - lecture-6
Cs 1114 - lecture-6Cs 1114 - lecture-6
Cs 1114 - lecture-6
 
Programming algorithms and flowchart.ppt
Programming algorithms and flowchart.pptProgramming algorithms and flowchart.ppt
Programming algorithms and flowchart.ppt
 
Cs 1114 - lecture-10
Cs 1114 - lecture-10Cs 1114 - lecture-10
Cs 1114 - lecture-10
 
presentation_python_11_1569171345_375360.pptx
presentation_python_11_1569171345_375360.pptxpresentation_python_11_1569171345_375360.pptx
presentation_python_11_1569171345_375360.pptx
 
Cs 1114 - lecture-9
Cs 1114 - lecture-9Cs 1114 - lecture-9
Cs 1114 - lecture-9
 
Mb0048 operations research
Mb0048 operations researchMb0048 operations research
Mb0048 operations research
 
Copy of dti2143/dam31303 chap 1 problem solving and program design
Copy of dti2143/dam31303 chap 1 problem solving and program designCopy of dti2143/dam31303 chap 1 problem solving and program design
Copy of dti2143/dam31303 chap 1 problem solving and program design
 
Cs 1114 - lecture-8
Cs 1114 - lecture-8Cs 1114 - lecture-8
Cs 1114 - lecture-8
 
28_09_2018 eMadrid seminar on MOOCs by Ralf Teusner, Hasso Plattner Institute...
28_09_2018 eMadrid seminar on MOOCs by Ralf Teusner, Hasso Plattner Institute...28_09_2018 eMadrid seminar on MOOCs by Ralf Teusner, Hasso Plattner Institute...
28_09_2018 eMadrid seminar on MOOCs by Ralf Teusner, Hasso Plattner Institute...
 
15 min guide to gmat (1)
15 min guide to gmat (1)15 min guide to gmat (1)
15 min guide to gmat (1)
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Metode Perancangan Program #2 Selection and Repetition Control Structure-ITSB...
Metode Perancangan Program #2 Selection and Repetition Control Structure-ITSB...Metode Perancangan Program #2 Selection and Repetition Control Structure-ITSB...
Metode Perancangan Program #2 Selection and Repetition Control Structure-ITSB...
 
Test case design_the_basicsv0.4
Test case design_the_basicsv0.4Test case design_the_basicsv0.4
Test case design_the_basicsv0.4
 
Covidien Dc Work Keys 101 2
Covidien Dc    Work Keys 101 2Covidien Dc    Work Keys 101 2
Covidien Dc Work Keys 101 2
 
Lab 6 sem ii_11_12
Lab 6 sem ii_11_12Lab 6 sem ii_11_12
Lab 6 sem ii_11_12
 
Algorithm & flow chart
Algorithm & flow chartAlgorithm & flow chart
Algorithm & flow chart
 
The gmat-unlocked
The gmat-unlockedThe gmat-unlocked
The gmat-unlocked
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box Testing
 

Recently uploaded

Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
marufrahmanstratejm
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 

Recently uploaded (20)

Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 

Fundamental Programming Lect 5

  • 1. Instructor : Muhammad HarisAll Rights Reserved to Department of Computer Science – GCU Lahore Programming Fundamentals
  • 2. Consider this Example  Determine status of a Student from marks of two of his subjects and his GPA If either the marks for both of the subjects are greater than 40 or GPA is greater than 2, he’s considered passed Programming Fundamentals | Lecture-5 2
  • 3. Programming Fundamentals | Lecture-5 3 START READ m1, m2, GPA DISPLAY “Passed” STOP (m1 > 40 AND m2 > 40) OR GPA > 2 YesNo DISPLAY “Failed”
  • 4. Another Example  Determine whether a student has got Grade A from his total marks and his GPA If marks are greater than 80 and less than 90 OR GPA is greater than 3.7 and less 3.8, he will be graded as “A” Programming Fundamentals | Lecture-5 4
  • 5. Programming Fundamentals | Lecture-5 5 START READ tm, GPA DISPLAY “A” STOP (tm > 80 AND tm < 90) OR (GPA > 3.7 AND GPA < 3.8) YesNo DISPLAY “Other than A”
  • 6. Try this Yourself  Determine whether a car is of mid-size type or not from its price (in millions) and engine capacity (in cc) If price is between 1 million and 2 million or if engine capacity is between 1000 and 1500, a car is considered to be a mid-size car Programming Fundamentals | Lecture-5 6
  • 7. Programming Fundamentals | Lecture-5 7 Decision Box Yes No > > <= < < >= == == != != != == <= <= > >= >= < Operator Opposite > <= < >= == != != == <= > >= <
  • 8. Decision leading to Decisions  In real-world problems, it frequently happens that result of a decision leads to further decision making  This way computer programs prove to be much more useful Programming Fundamentals | Lecture-5 8
  • 9. Consider this Example  For two numbers, do the following If second number is greater than 0 ○ Divide them If second number is less than 0 ○ Multiply them If second number is equal to 0 ○ Add them Programming Fundamentals | Lecture-5 9
  • 10. Programming Fundamentals | Lecture-5 10 START READ num1, num2 DISPLAY ans STOP ans = num1 / num2 num2 > 0 YesNo num2 < 0 ans = num1 * num2ans = num1 +num2 <= > Yes < No ==
  • 11. Another Example  For given roll number of a student, display his name Assume that there are only three students (first three roll numbers of your section) Programming Fundamentals | Lecture-5 11
  • 12. Programming Fundamentals | Lecture-5 12 START READ rollNo DISPLAY “Ali” STOP rollNo == 2 YesNo != == Yes <No rollNo == 4 rollNo == 8 DISPLAY “Rehman” DISPLAY “Hassan” DISPLAY “No Such Student” YesNo
  • 13. Try this Yourself  For given day number of the week, display the corresponding day Programming Fundamentals | Lecture-5 13 Day Number Week Day 1 Monday 2 Tuesday 3 Wednesday 4 Thursday
  • 14. Tasks (to be done by next lecture)  Display the name of a city against given city code Design your solution for 4-5 cities only  Calculate base pay from given annual salary and pay type Base pay = salary / Dividing Factor Programming Fundamentals | Lecture-5 14 Pay type Description Dividing Factor 1 Weekly 52 2 Bi-monthly 24 3 Monthly 12
  • 15. Programming Fundamentals | Lecture-5 15 BE PREPARED FOR QUIZ IN NEXT LECTURE

Editor's Notes

  1. Note: A decision box always leads to two paths, not more than two. But in this example you can see more than two paths. Hence one decision box is not sufficient to achieve this solution