Codeasy.net C# Beginner – Modulus
Day 47 #100DaysOfCode
![](https://i0.wp.com/gamedev.sinwyrm.com/wp-content/uploads/2019/12/2019-12-30_codeasy_beginner_modulus_odd_even.png?resize=392%2C244&ssl=1)
Today was focused on learning modulus and math functions over the course of four small programs. Nothing too taxing, it actually felt like an easier go of things over what I had been working on. Of course, that could also mean it’s all getting easier! One can hope.
The first program I had to write was one that used modulus to determine if an input number is odd or even. Easy. Next.
![](https://i0.wp.com/gamedev.sinwyrm.com/wp-content/uploads/2019/12/2019-12-30_codeasy_beginner_modulus_mindreader.png?resize=460%2C347&ssl=1)
The second program I had to write was one that essentially determines if a number is a multiple of thirteen or not. This one felt good to write as I was able to draw on things I had already learned (like arrays) and I was able to put together something short and tight like I saw in my head before even writing the code.
![](https://i0.wp.com/gamedev.sinwyrm.com/wp-content/uploads/2019/12/2019-12-30_codeasy_beginner_modulus_primes.png?resize=536%2C435&ssl=1)
The third program was one that struck me with dread the second I saw it – determine a prime number! For whatever reason I’ve never really been a big fan of prime numbers, or more to the point, being able to determine if a number is prime. I knew a program like this was going to rear its head at some point and here it was. The good thing was, having just learned about modulus, I actually had an idea of how to at least approach this program. I put down a few quick lines of code, made some initial tests of what I had, and determined what my program needed to have to yield proper results. By seeing this sort of math reduced to a short program actually made it WAY easier to understand! By looking at the program I knew to exclude 1 and the given number and only check if anything in between those values were evenly divisible.
Lastly, I just had to bang out a short program that used some math functions to determine the minimum of two input numbers and bring it to the power of a third number. This one was not hard at all and was only meant to show how the math functions worked.
Not a taxing day of coding, but it was fun to get the exposure to these types of programs.
![](https://i0.wp.com/gamedev.sinwyrm.com/wp-content/uploads/2019/12/2019-12-30_codeasy_beginner_modulus_math.png?resize=556%2C211&ssl=1)