SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Programming Fundamentals
Test Yourself ,[object Object],[object Object],Programming Fundamentals | Lecture-10
Consider this Example ,[object Object],[object Object],[object Object],Programming Fundamentals | Lecture-10
Find first n even numbers Programming Fundamentals | Lecture-9 START count = count + 1 STOP count < n count = 0 Yes No DISPLAY even even = 0 even = even + 2 All odd numbers are skipped by this solution
Find first n odd numbers Programming Fundamentals | Lecture-9 START count = count + 1 STOP count < n count = 0 Yes No DISPLAY odd odd = -1 odd = odd + 2 All even numbers are skipped by this solution
What’s Required ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Programming Fundamentals | Lecture-10
Remainder Operator ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Programming Fundamentals | Lecture-10
Programming Fundamentals | Lecture-10 START count = count + 1 STOP count < n count = 0 No No DISPLAY count “is odd” READ n count % 2 == 0 DISPLAY count “is even” Yes Yes
Important Observation ,[object Object],[object Object],Programming Fundamentals | Lecture-10
Try this Yourself ,[object Object],[object Object],Programming Fundamentals | Lecture-10
Programming Fundamentals | Lecture-10 START count = count + 1 STOP count < n count = 0 Yes No READ n count % 3 == 0 DISPLAY count Yes No
Consider this Example ,[object Object],[object Object],Programming Fundamentals | Lecture-10
Programming Fundamentals | Lecture-10 START count = count + 1 STOP count < n count = 0 Yes No READ n Yes No count % 2 != 0 count % 3 == 0 DISPLAY count Yes No
Consider this Example ,[object Object],Programming Fundamentals | Lecture-10
Programming Fundamentals | Lecture-10 START count = count + 1 STOP count < n count = 0 Yes No DISPLAY num * count READ num, n num != 0 No Yes No
Important Observation ,[object Object],[object Object],[object Object],[object Object],Programming Fundamentals | Lecture-10
A Premonition ,[object Object],[object Object],[object Object],Programming Fundamentals | Lecture-10
Tasks  (to be done by next lecture) ,[object Object],[object Object],Programming Fundamentals | Lecture-10
Programming Fundamentals | Lecture-10 BE PREPARED FOR  QUIZ IN NEXT LECTURE

Weitere Àhnliche Inhalte

Ähnlich wie Cs 1114 - lecture-10

Cs 1114 - lecture-8
Cs 1114 - lecture-8Cs 1114 - lecture-8
Cs 1114 - lecture-8
Zeeshan Sabir
 
Cs 1114 - lecture-3
Cs 1114 - lecture-3Cs 1114 - lecture-3
Cs 1114 - lecture-3
Zeeshan Sabir
 
Cs 1114 - lecture-9
Cs 1114 - lecture-9Cs 1114 - lecture-9
Cs 1114 - lecture-9
Zeeshan Sabir
 
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-5
Cs 1114 - lecture-5Cs 1114 - lecture-5
Cs 1114 - lecture-5
Zeeshan Sabir
 
ICT_Seminar_flow_charts_for_2013_Nov.pptx
ICT_Seminar_flow_charts_for_2013_Nov.pptxICT_Seminar_flow_charts_for_2013_Nov.pptx
ICT_Seminar_flow_charts_for_2013_Nov.pptx
ssuser2f67c91
 
How to add and multiply fractions
How to add and multiply fractionsHow to add and multiply fractions
How to add and multiply fractions
brandi28216
 
Saxman Hypermedia
Saxman HypermediaSaxman Hypermedia
Saxman Hypermedia
sdsaxman
 

Ähnlich wie Cs 1114 - lecture-10 (20)

Cs 1114 - lecture-8
Cs 1114 - lecture-8Cs 1114 - lecture-8
Cs 1114 - lecture-8
 
Cs 1114 - lecture-3
Cs 1114 - lecture-3Cs 1114 - lecture-3
Cs 1114 - lecture-3
 
Cs 1114 - lecture-9
Cs 1114 - lecture-9Cs 1114 - lecture-9
Cs 1114 - lecture-9
 
Fundamental Programming Lect 3
Fundamental Programming Lect 3Fundamental Programming Lect 3
Fundamental Programming Lect 3
 
4. algorithm
4. algorithm4. algorithm
4. algorithm
 
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
 
Fundamental Programming Lect 4
Fundamental Programming Lect 4Fundamental Programming Lect 4
Fundamental Programming Lect 4
 
Python Control structures
Python Control structuresPython Control structures
Python Control structures
 
Cs 1114 - lecture-5
Cs 1114 - lecture-5Cs 1114 - lecture-5
Cs 1114 - lecture-5
 
ICT_Seminar_flow_charts_for_2013_Nov.pptx
ICT_Seminar_flow_charts_for_2013_Nov.pptxICT_Seminar_flow_charts_for_2013_Nov.pptx
ICT_Seminar_flow_charts_for_2013_Nov.pptx
 
Std 10 computer chapter 9 Problems and Problem Solving
Std 10 computer chapter 9 Problems and Problem SolvingStd 10 computer chapter 9 Problems and Problem Solving
Std 10 computer chapter 9 Problems and Problem Solving
 
Course project solutions 2019
Course project solutions 2019Course project solutions 2019
Course project solutions 2019
 
The secret of Functional Programming revealed!
The secret of Functional Programming revealed!The secret of Functional Programming revealed!
The secret of Functional Programming revealed!
 
How to add and multiply fractions
How to add and multiply fractionsHow to add and multiply fractions
How to add and multiply fractions
 
02 Control Structures - Loops & Conditions
02 Control Structures - Loops & Conditions02 Control Structures - Loops & Conditions
02 Control Structures - Loops & Conditions
 
Fundamental Programming Lect 5
Fundamental Programming Lect 5Fundamental Programming Lect 5
Fundamental Programming Lect 5
 
Saxman Hypermedia
Saxman HypermediaSaxman Hypermedia
Saxman Hypermedia
 
1. guĂ­a de trabajo autĂłnomo 8vo 2021
1. guĂ­a de trabajo autĂłnomo 8vo  20211. guĂ­a de trabajo autĂłnomo 8vo  2021
1. guĂ­a de trabajo autĂłnomo 8vo 2021
 
FS Maths Level 2 – March 13, 2023 (Fractions-1).2
FS Maths Level 2 – March 13, 2023 (Fractions-1).2FS Maths Level 2 – March 13, 2023 (Fractions-1).2
FS Maths Level 2 – March 13, 2023 (Fractions-1).2
 

Mehr von Zeeshan Sabir

Cs 1114 - lecture-6
Cs 1114 - lecture-6Cs 1114 - lecture-6
Cs 1114 - lecture-6
Zeeshan Sabir
 
Cs 1114 - lecture-2
Cs 1114 - lecture-2Cs 1114 - lecture-2
Cs 1114 - lecture-2
Zeeshan Sabir
 
Cs 1114 - lecture-1
Cs 1114 - lecture-1Cs 1114 - lecture-1
Cs 1114 - lecture-1
Zeeshan Sabir
 
Cs 1114 - lecture-29
Cs 1114 - lecture-29Cs 1114 - lecture-29
Cs 1114 - lecture-29
Zeeshan Sabir
 
Human resource management process
Human resource management processHuman resource management process
Human resource management process
Zeeshan Sabir
 

Mehr von Zeeshan Sabir (6)

Cs 1114 - lecture-6
Cs 1114 - lecture-6Cs 1114 - lecture-6
Cs 1114 - lecture-6
 
Cs 1114 - lecture-2
Cs 1114 - lecture-2Cs 1114 - lecture-2
Cs 1114 - lecture-2
 
Cs 1114 - lecture-1
Cs 1114 - lecture-1Cs 1114 - lecture-1
Cs 1114 - lecture-1
 
Cs 1114 - lecture-29
Cs 1114 - lecture-29Cs 1114 - lecture-29
Cs 1114 - lecture-29
 
Final logic presentation
Final logic presentationFinal logic presentation
Final logic presentation
 
Human resource management process
Human resource management processHuman resource management process
Human resource management process
 

KĂŒrzlich hochgeladen

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

KĂŒrzlich hochgeladen (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Cs 1114 - lecture-10

  • 2.
  • 3.
  • 4. Find first n even numbers Programming Fundamentals | Lecture-9 START count = count + 1 STOP count < n count = 0 Yes No DISPLAY even even = 0 even = even + 2 All odd numbers are skipped by this solution
  • 5. Find first n odd numbers Programming Fundamentals | Lecture-9 START count = count + 1 STOP count < n count = 0 Yes No DISPLAY odd odd = -1 odd = odd + 2 All even numbers are skipped by this solution
  • 6.
  • 7.
  • 8. Programming Fundamentals | Lecture-10 START count = count + 1 STOP count < n count = 0 No No DISPLAY count “is odd” READ n count % 2 == 0 DISPLAY count “is even” Yes Yes
  • 9.
  • 10.
  • 11. Programming Fundamentals | Lecture-10 START count = count + 1 STOP count < n count = 0 Yes No READ n count % 3 == 0 DISPLAY count Yes No
  • 12.
  • 13. Programming Fundamentals | Lecture-10 START count = count + 1 STOP count < n count = 0 Yes No READ n Yes No count % 2 != 0 count % 3 == 0 DISPLAY count Yes No
  • 14.
  • 15. Programming Fundamentals | Lecture-10 START count = count + 1 STOP count < n count = 0 Yes No DISPLAY num * count READ num, n num != 0 No Yes No
  • 16.
  • 17.
  • 18.
  • 19. Programming Fundamentals | Lecture-10 BE PREPARED FOR QUIZ IN NEXT LECTURE