Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSI 101 Elements of Computing Spring 2009 Lecture #1 – From Math to Computers Wednesday, January 21, 2009.

Similar presentations


Presentation on theme: "CSI 101 Elements of Computing Spring 2009 Lecture #1 – From Math to Computers Wednesday, January 21, 2009."— Presentation transcript:

1 CSI 101 Elements of Computing Spring 2009 Lecture #1 – From Math to Computers Wednesday, January 21, 2009

2 Similarities to Math  Use of variables  Most of what you detail in programs are general  Variables represent values  Based on data  All functions and operations work with variables and data values

3 Level of Programming  Detailed, specific steps  Get down to level of one data value interacting with another  Think about how you are getting the data  Consider what you are doing with the data

4 Example  Find the largest of three numbers  Can only use less than or greater than  That comparison checks only two numbers  Thus, compare two of them, then compare the largest to the third

5 Math in Programs  Most programming languages use same mathematical operators as traditional math  Arithmetic : +, -, /  Multiplication is * instead of x  Equate: =  Comparison:, =  No symbol for root  Exponentiation uses different symbols

6 Arithmetic Example  Always remember that, in computers, the answer to a calculation is ALWAYS on the left side of the equation  It’s the variable you are placing the value into  In traditional math, it doesn’t matter which side Ans = A + 3*B

7 Order of Operations  Computers use the same order of operations as math 1.Parentheses 2.Exponentiation 3.Multiplication and Division 4.Addition and Subtraction

8 PEMDAS Example Ans = A + 3*B / 4 does not have the same answer as Ans = (A + 3*B)/4


Download ppt "CSI 101 Elements of Computing Spring 2009 Lecture #1 – From Math to Computers Wednesday, January 21, 2009."

Similar presentations


Ads by Google