Locked lesson.
About this lesson
In this lesson, we examine how Exponents work and what the Modulus is.
Exercise files
Download this lesson’s related exercise files.
14 - Math (Exponents and Modulus).docx60.8 KB 14 - Math (Exponents and Modulus) SOLUTION.docx
57.8 KB
Quick reference
Math (Exponents and Modulus)
Exponents allow us to raise numbers to the power of some other number. Modulus returns the remainder when you divide one number by another.
When to use
Use these whenever you need to use an exponent or return a remainder of division.
Instructions
int x = 3;
int y = 2;
Math.Pow(x,y); // exponent
x % y // modulus
Hints & tips
- Math.Pow(x,y); // exponent - x to the power of y
- x % y // modulus returns remainder of division (x divided by y)
Lesson notes are only available for subscribers.