When would one want to make use of the / operator? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

When would one want to make use of the / operator?

This one noted that he / operator in certain languages, including C# serves the purpose of getting the quotient of two values while truncating the remainder giving one an integer. When would one want to do this? What sort of arithmetic would one be working out in a use case that calls for /?

21st Jan 2020, 12:15 PM
The Architect
3 Answers
+ 2
You get the quotient in integer division and when your result is of type integer. Eg. You need 3 apples to make a pie. You have 20 apples. How many pies you can make?
21st Jan 2020, 12:32 PM
Mihai Apostol
Mihai Apostol - avatar
+ 1
Nice example. Thanks Mihai.
21st Jan 2020, 1:50 PM
The Architect
+ 1
You're welcome.
21st Jan 2020, 1:55 PM
Mihai Apostol
Mihai Apostol - avatar