Contact: aviboots(AT)netvision.net.il

23,335 questions

30,538 answers

573 users

#include <iostream> int main(void) { int n = 26, divisor = 7; int remainder = n; while (remainder >= divisor) { remainder = remainder - divisor; } std::cout << "The remainder is: " << remainder; } /* run: The remainder is: 5 */

#include <iostream> int main(void) { int n = 26, divisor = 7; int remainder = n - divisor * (n / divisor); std::cout << "The remainder is: " << remainder; } /* run: The remainder is: 5 */