Chapter03.pdf - Chapter 3 Variables Input and Output Numbers Arithmetic operations Variables Incrementing the value of a variable Built-in functions

# Chapter03.pdf - Chapter 3 Variables Input and Output...

• Notes
• 75

This preview shows page 1 - 14 out of 75 pages.

Chapter 3 Variables, Input, and Output
Numbers Arithmetic operations Variables Incrementing the value of a variable Built-in functions: Math.Sqrt Int Math.Round 12/30/2016 BPB2034 Programming For Business Applications 2 Examples: Math.Sqrt (9) → 3 Int (6.3) → 6 Math.Round (6.3) → 6 Math.Round (6.6) → 7
Numbers ( con’t ) The Integer Data Type Multiple Declarations Two Integer-Valued Operators Parentheses, Order of precedence Three Types of Errors The Error List Window 12/30/2016 BPB2034 Programming For Business Applications 3
Arithmetic Operations Numbers are called numeric literals E.g. 4, 2.3, 1000, -5.2, -99 Five standard arithmetic operations in Visual Basic + addition - subtraction * multiplication / division ^ exponentiation 12/30/2016 BPB2034 Programming For Business Applications 4
Numeric Expressions How are we represent numeric expression in Visual Basic? 12/30/2016 BPB2034 Programming For Business Applications 5 Mathematic Notation Visual Basic Notation 2 + 3 2 + 3 3 × (4 + 5) 3 * (4 + 5) 2 3 2 ^ 3 2 + 3 2 5 (2 + 3 ^ 2) / 5
Displaying Numbers Let n be a number or a numeric expression. The statement lstBox.Items.Add(n) displays the value of n in the list box. 12/30/2016 BPB2034 Programming For Business Applications 6