image
Educational Outreach

Introduction to Programming

Lesson 3: Logic

Intro to programming

 

Learning Outcomes 

-Students will explain logic in terms of programming and code

-Students will interpret logic operations to create if and else statements

- Students will create If and Else statements in C to demonstrate what they learned about logic. 

Materials 

How It Works 

The best place to start learning about logic is with the if and else statements. On top of learning these statements, students will also perform a few simple logic operations which include: is equal, not equal, less/greater than, less/greater than or equal to, “or” statements, and “and” statements. After this lesson you will have a basic knowledge of how logic in a computer works, as well as being able to do simple logic operations to evaluate inputs. 

Activity 

  1. Part 1: Learn new logic operations
  2. Part 2: "or” and “and” statements
  3. Part 3: If and else statements

Assessment

  1. With the following information, write a conditional statement:
    You want to drive to Disney, and you are 50 miles away, but you only have 20 miles worth of gas, can you make it without stopping?
  2. Reading the definition of the modulus function, what is 15%4?
  3. What is 15%5?

Additional Resources

  1. Programming Lesson 3: Logic Lesson plan
  2. Vocabulary
  3. Teachers Guide
  4. https://www.w3schools.com/
  5. https://www.geeksforgeeks.org/c-programming-language/
  6. https://replit.com/languages/c