Modulo Operator ( % ) in C / C ++ with Examples | Program to illustrate the working of the modulo operator ; To store two integer values ; To store the result of the modulo expression
#include <iostream> NEW_LINE using namespace std ; int main ( void ) { int x , y ; int result ; x = -3 ; y = 4 ; result = x % y ; cout << result << endl ; x = 4 ; y = -2 ; result = x % y ; cout << result << endl ; x = -3 ; y = -4 ; result = x % y ; cout << result ; return 0 ; }