Assignment statement:

Slides:



Advertisements
Similar presentations
Operators and Arithmetic Operations. Operators An operator is a symbol that instructs the code to perform some operations or actions on one or more operands.
Advertisements

Exponential Form A form of writing the product of a factor that repeats Base: The base is the factor being repeatedly multiplied Exponent: The exponent.
A.K.A “BEDMAS”. Order of Operations The Order of Operations is the order in which to solve a mathematical problem. You must solve problems using the order.
Evaluate expressions with grouping symbols
Objective A: To Evaluate Exponential Expressions
1 MATERI PENDUKUNG OPERATOR Matakuliah: M0074/PROGRAMMING II Tahun: 2005 Versi: 1/0.
Chapter 3 Math Vocabulary
Sections 1.4 and 1.5 Order of Operations, Part 1
Transparency 2 Click the mouse button or press the Space Bar to display the answers.
2440: 211 Interactive Web Programming Expressions & Operators.
Computer Science Selection Structures.
Objective 1: To multiply monomials. Objective 2: To divide monomials and simplify expressions with negative exponents.
Base: the number that is multiplied Power: the number that is expressed as the exponent Exponent: tell how many times the base is used as a factor Standard.
Orders of Operations Section 1.6. Objective Perform any combination of operations on whole numbers.
Bell Ringer = – 5 = = ÷ -2 = =6. -7 – (-7) = After you have completed the bell ringer, take out your homework!
Order of Operations.
1 Boolean Expressions to Make Comparisons Boolean expression –Represents only one of two states –Expression evaluates to either true or false Expressions.
Chapter 1: The Language of Algebra You will learn: To use variables to represent unknown quantities Words to Learn: Variables: letters used to ______________.
Evaluating a Variable Expression To evaluate a variable expression:
Order of Operations - rules for arithmetic and algebra that describe what sequence to follow to evaluate an expression involving more than one operation.

MM150 Unit 3 Seminar Agenda Seminar Topics Order of Operations Linear Equations in One Variable Formulas Applications of Linear Equations.
1-2 Order of Operations and Evaluating Expressions.
Assignment statement: Assigns a value to a variable Variable must appear on the left side, value on the right side of the assignment operator Right side.
Welcome to... A Game of X’s and O’s. Another Presentation © All rights Reserved
Intro to Exponents Learn to evaluate expressions with exponents.
ORDER OF OPERATIONS. What is the correct method for solving numerical problems?
Expressions and Equations 5.ATO.1 Evaluate numerical expressions involving grouping symbols (i.e., parentheses, brackets, braces). 5.ATO.2 Translate verbal.
ORDER OF OPERATIONS LESSON 2.
Mental Math Everyone Take out a sheet of paper and Number your page = = = = = =
1-2 Order of Operations Objective: Use the order of operations to evaluate expressions.
Order of Operations ( ) + X . What are the Operations? ( ) + X 
§ 1.8 Exponents and Order of Operations. Definition of Natural Number Exponent If b is a real number and n is a natural number, b is the base and n is.
Equations and The Order of Operations. Page  2 Section 1: Variables and Expressions  Variables –Are letters or symbols that act as placeholders for.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Evaluating Algebraic Expressions 4-1Exponents AF2.1 Interpret positive whole-number powers as repeated multiplication and negative whole-number powers.
Any questions on today’s homework? (Section 1.3B) Reminder: You should be doing this homework without using a calculator, because calculators can’t be.
P= Parentheses E= Exponents M= Multiplication D= Division A= Addition S= Subtraction.
Chapter Sections 1.1 – Study Skills for Success in Mathematics
CLOSE Please YOUR LAPTOPS, and get out your note-taking materials.
Variables and Expressions
Exponents and Order of Operations
The Order of Operations
So, to simplify an expression using order of operations, you should:
Any questions on today’s homework. (Section 1
Arithmetic operations & assignment statement
4 Chapter Chapter 2 Decimals.
Introduction to Algebra
Order of Operations Operations are symbols in math.
Learn to evaluate expressions with exponents.
Order Of Operations.
ORDER OF OPERATIONS BEMDAS. 1. Brackets - ( ) or [ ]
43 Order of Operations  ( ) + - X.
Accentuate the Negative
1-9 Order of operations and distributive property
Learn to evaluate expressions with exponents.
Chapter 3: Selection Structures: Making Decisions
Boolean Expressions to Make Comparisons
Week 1 Real Numbers and Their Properties
43 Order of Operations  ( ) + - X.
Relational Operators.
Chapter 3: Selection Structures: Making Decisions
Exercise In what order would you perform these operations? 2 + 3(4)
43 Order of Operations  ( ) + - X.
Solve in Groups (Standard Write and Interpret numerical expressions )
Chapter 3: Selection Structures: Making Decisions
What do you think it means? Before:
Evaluating Expressions
5.03 Apply operators and Boolean expressions
Ch 1-2 Order of Operations
Presentation transcript:

Assignment statement: Assigns a value to a variable Variable must appear on the left side, value on the right side of the assignment operator Right side may be an expression that will be evaluated before storing the value in the variable Assignment operator: the equal sign (=) in most languages Variable: Memory location: has an address and a value Value (contents) is used for various operations

Arithmetic Operations + Addition 2 + 3 = 5 - Subtraction 7 – 3 = 4 * Multiplication 5 * 4 = 20 / Division 12 / 3 = 4 ^ Exponentiation 2 ^ 3 = 8 % Modulus 14 % 3 = 2

Assignment, Math, Operators Add: + variable = variable + 15 Subtract: - variable1 = variable2 – variable3 Multiply: * varible5 = varible8 * variable3 Divide: / variable19 / 5 Parenthesis: ( ) (variable33 * 12) Bracket: { } or [ ] {variable65 – variable10} Exponent: ^ (caret) variable12 ^ 3

Hierarchy of Operations 1st: perform operations inside parentheses (from inside out if more than one) 2nd: perform exponentiation 3rd: do multiplications, divisions, and modulus from left to right (if there are more than one) 4th: do additions and subtractions from left to right (if there are more than one)

Assignment, Math, Operators Order of Operations Equations resolved in order below (from top to bottom) Left to Right Bracket: { } or [ ] Parenthesis: ( ) Exponent: ^ (caret) Multiply: * Divide: / Add: + Subtract: -

Assignment, Math, Operators var3 + var5 * 3 / {var12 + var13 / (3 ^ var6 * (var9))} + 2 2 1 3 4 5 6 7 9 8

Example of Hierarchy of Operations 3 * (6 + 2) / 12 – (7 – 5) ^ 2 * 3 = ? ( ) first: = 3 * 8 / 12 – 2 ^ 2 * 3 ^ next: = 3 * 8 / 12 – 4 * 3 Leftmost * next: = 24 / 12 – 4 * 3 Division next: = 2 – 4 * 3 Multiply next: = 2 – 12 Subtract last: = -10

Relational Operators Relational operators are the symbols used in the condition to be evaluated in If statements: = equal to <> not equal to < less than > greater than <= less than or equal to >= greater than or equal to

Comparison vs. Assignment The equals sign (=) in this text may have two different meanings. The difference is very significant. As an assignment operator, the equals sign sets the value of an expression on the right side to the variable on the left side. As a comparison operator, the equals sign asks the question, “Is the value of the variable on the left side the same as the value of the expression, number, or variable on the right side?” Many programming languages distinguish between these two operators as follows: a single equals sign (=) signifies the assignment operator a double equals sign (==) signifies the comparison operator This is demonstrated in the examples that follow in the next slides.

Logical Operators Logical operators are used to connect simple conditions into a more complex condition called a compound condition. AND OR NOT

Hierarchy of Operations Type Operator Order Performed Arithmetic operations are performed first, in order shown ( ) ^ * / % + - 1st parentheses 2nd exponentiation 3rd: multiplication, division, modulus 4th: addition, subtraction Relational operations are performed second = <> < <= > >= All relational operators have equal precedence Logical operations are performed last, in the order shown NOT AND OR 1st: NOT 2nd: AND 3rd: OR