SlideShare a Scribd company logo
Programming Fundamentals
Tasks  (from previous lecture) Calculate area of a rectangle area = base    height Find Cube of a Number Calculate Marks Percentage (marks obtained / total marks)    100 Calculate Sales Tax amount    (tax percent / 100) Find “no. of minutes” and “no. of seconds” for given “no of years” Programming Fundamentals | Lecture-3
Power of Computer Programs Once given the input They perform the instructions (or no. of steps as instructed by the programmer) themselves and give the desired output No matter how complex the problem is and how long they have to work on it Programming Fundamentals | Lecture-3 Now We Will Further Explore Their Power
Consider this Problem Find absolute value after subtracting one number from another Difference =  number1 – number2 Programming Fundamentals | Lecture-3
Difference of Two numbers Programming Fundamentals | Lecture-3 START READ number1, number2 difference = number1 - number2 DISPLAY difference STOP Will result in a negative value if number1 is smaller than number2
Is This Solution Correct? Programming Fundamentals | Lecture-3 START READ number1, number2 difference = number1 - number2 DISPLAY difference STOP difference = difference * -1
Analyze the Problem There exists two conditions Condition-1 Difference is positive Condition-2 Difference is negative Programming Fundamentals | Lecture-3
What is to be Done? There exists two conditions Condition-1 Difference is positive Do not do any conversion, because value is already positive Condition-2 Difference is negative Convert it into a positive value by multiplying it by “-1” Programming Fundamentals | Lecture-3
Should we design  two different solutions? Programming Fundamentals | Lecture-1
What is Required? Need to design a solution in such a way which can decide for itself whether to multiply the difference by “-1” or not (by checking the value of difference) The graphical shapes which we have learned so far are insufficient to provide this kind of “ decision making ” Programming Fundamentals | Lecture-3
Decision Box Programming Fundamentals | Lecture-3 Decision Rule Yes No Always in the form whose answer is  “ Yes” or “No”
Programming Fundamentals | Lecture-3 START READ number1, number2 difference = number1 - number2 DISPLAY difference STOP difference = difference * -1 difference < 0 Yes No
Power of Computers Decision Making Programmers can instruct computers to make decisions while solving a problem As the complexity of problems increases, decision making process become more extensive This way computers prove very useful by performing laborious tasks of decision making Programming Fundamentals | Lecture-3
Another Example Find smaller of two numbers Input number1 number2 Output smaller Processing Compare the numbers with each other and decide which one is smaller Programming Fundamentals | Lecture-3
Programming Fundamentals | Lecture-3 START READ number1, number2 DISPLAY smaller STOP smaller = number1 number1 < number2 Yes No smaller = number2
Alternative Programming Fundamentals | Lecture-3 START READ number1, number2 STOP DISPLAY number1 number1 < number2 Yes No DISPLAY number2
Comparison Operators < (less than) > (greater than) <= (less than equal to) >= (greater than equal to) == (equal to) != (not equal to) Programming Fundamentals | Lecture-3
Output a Message Programming Fundamentals | Lecture-3 DISPLAY “This is a message”
Try it Yourself Find whether a number is negative or not? Find whether two numbers are  equal  or not? Multiply two numbers if their difference is  greater than  0 Programming Fundamentals | Lecture-3
Some Keywords Look for these keywords in problem statement in order to determine the usage of decision box If If and only if Whether Programming Fundamentals | Lecture-3
Tasks  (to be done by next lecture) Find  whether  the sum of two numbers is greater than 50 Find  whether  the sum of two numbers is greater than the third number? Divide a number by another  if only if  the second number is not equal to “0” Determine  whether  a student is “passed” or “failed” from his marks A student securing marks less than 50 is considered “failed” Programming Fundamentals | Lecture-3
Programming Fundamentals | Lecture-2 BE PREPARED FOR  QUIZ  IN  NEXT LECTURE

More Related Content

PPTX
Angles and Measures
Jhon Paul Lagumbay
 
PPTX
week 2 angle pairs matatag curriculum grade 7.pptx
RONIEBAGSICAN1
 
PPT
Fundamental Programming Lect 3
Namrah Erum
 
PDF
Lesson Plan Algebra Fundamental Operations
Ji Ji Thomas
 
DOCX
Q4 M9GE-IVf-g-1 illustrates laws of sines and cosines. Uddiawan NHS.docx
randygalamay2
 
PPTX
Trigonometric function
Azurah Razak
 
PPT
Circles
Erlyn Geronimo
 
DOCX
Absolute Value
DC Marie Lagura
 
Angles and Measures
Jhon Paul Lagumbay
 
week 2 angle pairs matatag curriculum grade 7.pptx
RONIEBAGSICAN1
 
Fundamental Programming Lect 3
Namrah Erum
 
Lesson Plan Algebra Fundamental Operations
Ji Ji Thomas
 
Q4 M9GE-IVf-g-1 illustrates laws of sines and cosines. Uddiawan NHS.docx
randygalamay2
 
Trigonometric function
Azurah Razak
 
Absolute Value
DC Marie Lagura
 

What's hot (20)

PPTX
Sss congruence Postulate
Elton John Embodo
 
PPTX
Word Problems Involving Right Triangles
RheaAnnDiaz2
 
PPTX
Finding the Nth Term of a Sequence and.pptx
WillbertBalangat1
 
PDF
detailed-lesson-plan-math-9.pdf
CleofeAttosTomasUndo
 
PPTX
Angles-of-Elevation-and-Depression.pptx
SanoSuki
 
PDF
9.1 Systems of Linear Equations
smiller5
 
PPTX
Arithmetic sequence
Cajidiocan National High School
 
PPT
Solving Inequalities (Algebra 2)
rfant
 
PDF
11.1 Circumference and Area of Circles
smiller5
 
PDF
2.4 Linear Functions
smiller5
 
PPTX
Solving Two-Step Equations-PPT part 1
Howarde4edu290
 
PPTX
Basic Mathematics 3 5 Presentation
David Radcliffe
 
PPTX
the circle and its parts.pptx
MariaCatherineErfeLa
 
PPTX
Geometric series
Jhon Paul Lagumbay
 
PDF
Linear equation in one variable
Nadeem Uddin
 
PDF
Financial Literacy Among the Senior High School Students: Basis for Financial...
IJAEMSJORNAL
 
PPT
Proving Trigonometric Identities
Kristen T
 
PDF
Arithmetic Series
Free Math Powerpoints
 
PPTX
5.2 Solving Quadratic Equations by Factoring
hisema01
 
PDF
Property of Equality Grade 7 lesson.pdf
ChristineJenBautista
 
Sss congruence Postulate
Elton John Embodo
 
Word Problems Involving Right Triangles
RheaAnnDiaz2
 
Finding the Nth Term of a Sequence and.pptx
WillbertBalangat1
 
detailed-lesson-plan-math-9.pdf
CleofeAttosTomasUndo
 
Angles-of-Elevation-and-Depression.pptx
SanoSuki
 
9.1 Systems of Linear Equations
smiller5
 
Arithmetic sequence
Cajidiocan National High School
 
Solving Inequalities (Algebra 2)
rfant
 
11.1 Circumference and Area of Circles
smiller5
 
2.4 Linear Functions
smiller5
 
Solving Two-Step Equations-PPT part 1
Howarde4edu290
 
Basic Mathematics 3 5 Presentation
David Radcliffe
 
the circle and its parts.pptx
MariaCatherineErfeLa
 
Geometric series
Jhon Paul Lagumbay
 
Linear equation in one variable
Nadeem Uddin
 
Financial Literacy Among the Senior High School Students: Basis for Financial...
IJAEMSJORNAL
 
Proving Trigonometric Identities
Kristen T
 
Arithmetic Series
Free Math Powerpoints
 
5.2 Solving Quadratic Equations by Factoring
hisema01
 
Property of Equality Grade 7 lesson.pdf
ChristineJenBautista
 
Ad

Similar to Cs 1114 - lecture-3 (20)

PPT
Cs 1114 - lecture-4
Zeeshan Sabir
 
PPT
Fundamental Programming Lect 4
Namrah Erum
 
PPT
Cs 1114 - lecture-2
Zeeshan Sabir
 
PPT
Cs 1114 - lecture-9
Zeeshan Sabir
 
PPT
Cs 1114 - lecture-10
Zeeshan Sabir
 
PPT
Fundamental Programming Lect 2
Namrah Erum
 
PPT
Cs 1114 - lecture-5
Zeeshan Sabir
 
PPTX
Basic pogramming concepts
Anurag Prajapat
 
PPT
Fundamental Programming Lect 5
Namrah Erum
 
PPT
Programming Fundamentals - Lecture 1.ppt
FarhanGhafoor7
 
PPSX
CC-112-Lec.1.ppsx
Aamir Shahzad
 
PDF
classVIII_Coding_Book018979929470479.pdf
menolem379
 
PPTX
classVIII_Coding_Teacher_Presentation.pptx
bhanutickets
 
PPTX
Programming Fundamentals
Trivuz ত্রিভুজ
 
PPTX
Unit 1 Introduction Part 3.pptx
NishaRohit6
 
PPTX
classVII_Coding_Teacher_Presentation.pptx
ssusere336f4
 
PPTX
Basics of C programming - day 2
Ajay Khatri
 
PPT
Basic of Programming (Introduction to Programming)
JohnNama
 
PPTX
Software fundamentals
Susan Winters
 
PPT
Programming.pptVBVBBMCGHFGFDFDHGDFKJKJKKJ;J
AlthimeseAnderson
 
Cs 1114 - lecture-4
Zeeshan Sabir
 
Fundamental Programming Lect 4
Namrah Erum
 
Cs 1114 - lecture-2
Zeeshan Sabir
 
Cs 1114 - lecture-9
Zeeshan Sabir
 
Cs 1114 - lecture-10
Zeeshan Sabir
 
Fundamental Programming Lect 2
Namrah Erum
 
Cs 1114 - lecture-5
Zeeshan Sabir
 
Basic pogramming concepts
Anurag Prajapat
 
Fundamental Programming Lect 5
Namrah Erum
 
Programming Fundamentals - Lecture 1.ppt
FarhanGhafoor7
 
CC-112-Lec.1.ppsx
Aamir Shahzad
 
classVIII_Coding_Book018979929470479.pdf
menolem379
 
classVIII_Coding_Teacher_Presentation.pptx
bhanutickets
 
Programming Fundamentals
Trivuz ত্রিভুজ
 
Unit 1 Introduction Part 3.pptx
NishaRohit6
 
classVII_Coding_Teacher_Presentation.pptx
ssusere336f4
 
Basics of C programming - day 2
Ajay Khatri
 
Basic of Programming (Introduction to Programming)
JohnNama
 
Software fundamentals
Susan Winters
 
Programming.pptVBVBBMCGHFGFDFDHGDFKJKJKKJ;J
AlthimeseAnderson
 
Ad

More from Zeeshan Sabir (7)

PPT
Cs 1114 - lecture-8
Zeeshan Sabir
 
PPT
Cs 1114 - lecture-7
Zeeshan Sabir
 
PPT
Cs 1114 - lecture-6
Zeeshan Sabir
 
PPT
Cs 1114 - lecture-1
Zeeshan Sabir
 
PPT
Cs 1114 - lecture-29
Zeeshan Sabir
 
PPT
Final logic presentation
Zeeshan Sabir
 
PPT
Human resource management process
Zeeshan Sabir
 
Cs 1114 - lecture-8
Zeeshan Sabir
 
Cs 1114 - lecture-7
Zeeshan Sabir
 
Cs 1114 - lecture-6
Zeeshan Sabir
 
Cs 1114 - lecture-1
Zeeshan Sabir
 
Cs 1114 - lecture-29
Zeeshan Sabir
 
Final logic presentation
Zeeshan Sabir
 
Human resource management process
Zeeshan Sabir
 

Recently uploaded (20)

PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PDF
Doc9.....................................
SofiaCollazos
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PPTX
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
Beyond Automation: The Role of IoT Sensor Integration in Next-Gen Industries
Rejig Digital
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Software Development Methodologies in 2025
KodekX
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
Doc9.....................................
SofiaCollazos
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Beyond Automation: The Role of IoT Sensor Integration in Next-Gen Industries
Rejig Digital
 

Cs 1114 - lecture-3

  • 2. Tasks (from previous lecture) Calculate area of a rectangle area = base  height Find Cube of a Number Calculate Marks Percentage (marks obtained / total marks)  100 Calculate Sales Tax amount  (tax percent / 100) Find “no. of minutes” and “no. of seconds” for given “no of years” Programming Fundamentals | Lecture-3
  • 3. Power of Computer Programs Once given the input They perform the instructions (or no. of steps as instructed by the programmer) themselves and give the desired output No matter how complex the problem is and how long they have to work on it Programming Fundamentals | Lecture-3 Now We Will Further Explore Their Power
  • 4. Consider this Problem Find absolute value after subtracting one number from another Difference = number1 – number2 Programming Fundamentals | Lecture-3
  • 5. Difference of Two numbers Programming Fundamentals | Lecture-3 START READ number1, number2 difference = number1 - number2 DISPLAY difference STOP Will result in a negative value if number1 is smaller than number2
  • 6. Is This Solution Correct? Programming Fundamentals | Lecture-3 START READ number1, number2 difference = number1 - number2 DISPLAY difference STOP difference = difference * -1
  • 7. Analyze the Problem There exists two conditions Condition-1 Difference is positive Condition-2 Difference is negative Programming Fundamentals | Lecture-3
  • 8. What is to be Done? There exists two conditions Condition-1 Difference is positive Do not do any conversion, because value is already positive Condition-2 Difference is negative Convert it into a positive value by multiplying it by “-1” Programming Fundamentals | Lecture-3
  • 9. Should we design two different solutions? Programming Fundamentals | Lecture-1
  • 10. What is Required? Need to design a solution in such a way which can decide for itself whether to multiply the difference by “-1” or not (by checking the value of difference) The graphical shapes which we have learned so far are insufficient to provide this kind of “ decision making ” Programming Fundamentals | Lecture-3
  • 11. Decision Box Programming Fundamentals | Lecture-3 Decision Rule Yes No Always in the form whose answer is “ Yes” or “No”
  • 12. Programming Fundamentals | Lecture-3 START READ number1, number2 difference = number1 - number2 DISPLAY difference STOP difference = difference * -1 difference < 0 Yes No
  • 13. Power of Computers Decision Making Programmers can instruct computers to make decisions while solving a problem As the complexity of problems increases, decision making process become more extensive This way computers prove very useful by performing laborious tasks of decision making Programming Fundamentals | Lecture-3
  • 14. Another Example Find smaller of two numbers Input number1 number2 Output smaller Processing Compare the numbers with each other and decide which one is smaller Programming Fundamentals | Lecture-3
  • 15. Programming Fundamentals | Lecture-3 START READ number1, number2 DISPLAY smaller STOP smaller = number1 number1 < number2 Yes No smaller = number2
  • 16. Alternative Programming Fundamentals | Lecture-3 START READ number1, number2 STOP DISPLAY number1 number1 < number2 Yes No DISPLAY number2
  • 17. Comparison Operators < (less than) > (greater than) <= (less than equal to) >= (greater than equal to) == (equal to) != (not equal to) Programming Fundamentals | Lecture-3
  • 18. Output a Message Programming Fundamentals | Lecture-3 DISPLAY “This is a message”
  • 19. Try it Yourself Find whether a number is negative or not? Find whether two numbers are equal or not? Multiply two numbers if their difference is greater than 0 Programming Fundamentals | Lecture-3
  • 20. Some Keywords Look for these keywords in problem statement in order to determine the usage of decision box If If and only if Whether Programming Fundamentals | Lecture-3
  • 21. Tasks (to be done by next lecture) Find whether the sum of two numbers is greater than 50 Find whether the sum of two numbers is greater than the third number? Divide a number by another if only if the second number is not equal to “0” Determine whether a student is “passed” or “failed” from his marks A student securing marks less than 50 is considered “failed” Programming Fundamentals | Lecture-3
  • 22. Programming Fundamentals | Lecture-2 BE PREPARED FOR QUIZ IN NEXT LECTURE