C
C#7d ago
Faker

✅ Operators in C#

Hello, can someone explain what is being said here that we will get inaccurate results; I try it and get the correct result of 1.4 for some cases.
No description
4 Replies
Sehra
Sehra7d ago
first three would not compile since you can't assign decimal to int without an explicit cast
Faker
FakerOP7d ago
ahh didn't noticed that last one will give 1 yeah because it's treated as "integer division" ?
Sehra
Sehra7d ago
last would compile, but would perform floor division since both are integers
Faker
FakerOP7d ago
yep I see, thanks !

Did you find this page helpful?