Arithmetic Operators Flashcards
(25 cards)
What are the three types of operators?
Unary
Binary
Ternary
What does the + operator do?
Addition (total = cost + tax;)
What does the - operator do?
Subtraction (cost = total - tax;)
What does the / operator do?
Division (salePrice = original / 2;)
What does the % operator do?
Modulus (remainder = value % 3;)
What does the * operator do?
Multiplication (tax = cost * rate;)
When a int is divided by another int what happens?
The remainders shall be discarded
What does the method Math.Pow() do?
Returns a specified number raised to a specific power
What does the method Math.Sqrt() do?
Returns the square root of a specific number
What does the method Math.Round() do?
Rounds to nearest integer, or to specified number of digits (result = Math.Round(1.3768); = 1 or Math.Round(1.3768, 2); = 1.38)
What does the += combined operator mean?
x = x + 5 (x += 5;)
What does the -= combined operator mean?
x = x - 5 (x -= 5;)
What does the *= combined operator mean?
x = x * 5 (x *= 5;)
What does the /= combined operator mean?
x = x / 5 (x /= 5;)
What does the %= combined operator mean?
x = x % 5 (x %= 5;)
What does the const keyword do to a variable?
It is used to make a variable a constant that cannot be changed (const double GST_RATE = 0.05;)
What is a booleon value?
It is a data type that can either be True or False (staticvoidMain(string[] args) { bool isManager; isManager = true; Console.WriteLine(isManager); isManager = false; Console.WriteLine(isManager); })
What is a char value?
A char is a value that is a single letter (staticvoidMain(string[] args) { charletter; letter = 'A'; Console.WriteLine(letter); letter = 'B'; Console.WriteLine(letter); })
What is Parsing?
It will convert a value into another value (age = int.Parse(Console.ReadLine());)
What is the < operator?
Means less than
What is the <= operator?
Less than or equal to (≤)
What is the > operator?
Greater than
What is the >= operator?
Greater than or equal to(≥)
What is the == operator?
Equal to (=)