% operator is used for modulus.. i.e. it takes out a remainder...e.g 2%3 gives you 2 and 4%2 gives you 0.
2%3 gives you 2 and 4%2 gives you 0. why work that i dont know please tell me the working of modulus % operator
Hi, The '%' sign in c++ called the remainder.Which means that the remainder of some thing as when we devide 5 by 2 then 2 goes only 2 times as 2*2=4 which is less then 5 so the remaining thing is 1.this one is called remainder of 5 by two.it can be written as 5%2=1. I hope this enough for you to understand the working of '%' in c++.If it not works then tell me again.
Was there any subject in your school known as "Mathematics"? In mathematics there is a concept known as "remainder"...read that first and then ask question....