Wigger Tolsma

Wigger Tolsma

  • NA
  • 4
  • 3.2k

What does the % operator exactly do?

Aug 9 2013 2:30 PM
Today I had an assignment that told me to only allow numbers through that are a multiplication of 5.
After looking around on the internet I found the % operator. I thought this operator only removed the decimals, for example 5 % 2 equals 2.
But I could use it in my program as if(iWithdraw % 5 == 0){do this and that}.
I'm glad it worked but I still don't know why it worked haha.
Can someone explain this to me?

Answers (3)