0
0
C Sharp (C#)programming~5 mins

Arithmetic operators in C Sharp (C#) - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What are arithmetic operators in C#?
Arithmetic operators are symbols used to perform basic math operations like addition (+), subtraction (-), multiplication (*), division (/), and modulus (%).
Click to reveal answer
beginner
What does the modulus operator (%) do?
The modulus operator (%) gives the remainder after dividing one number by another. For example, 7 % 3 equals 1 because 7 divided by 3 leaves a remainder of 1.
Click to reveal answer
beginner
How does integer division behave in C#?
When you divide two integers, C# returns the whole number part only, dropping any decimal. For example, 7 / 3 equals 2, not 2.333.
Click to reveal answer
intermediate
What is the result of this C# expression: 5 + 3 * 2?
The result is 11 because multiplication (*) has higher priority than addition (+). So, 3 * 2 = 6, then 5 + 6 = 11.
Click to reveal answer
beginner
Explain the difference between / and % operators in C#.
The / operator divides two numbers and returns the quotient (the result of division). The % operator returns the remainder left after division. For example, 10 / 3 is 3, and 10 % 3 is 1.
Click to reveal answer
What is the output of: int result = 10 / 4; Console.WriteLine(result); ?
A2
B2.5
C3
D4
Which operator gives the remainder of a division in C#?
A+
B-
C/
D%
What is the result of: 8 + 2 * 5?
A20
B18
C50
D30
Which operator is used for multiplication in C#?
A*
B/
C+
D-
What will be the output of: Console.WriteLine(15 % 4); ?
A1
B4
C3
D15
Describe the main arithmetic operators in C# and give a simple example for each.
Think about +, -, *, /, and % symbols.
You got /6 concepts.
    Explain how operator precedence affects the result of arithmetic expressions in C#.
    Consider how 5 + 3 * 2 is calculated.
    You got /4 concepts.