Back to Code Walkthrough
Modulo and Division With Negative Numbers
C++ code walkthrough · Question 42Code
Read carefully. What does this print?1#include <iostream>2using namespace std;34int main() {5 cout << -7 / 2 << " " << -7 % 2 << endl;6 cout << 7 / -2 << " " << 7 % -2 << endl;7 cout << (-7 / 2) * 2 + (-7 % 2) << endl;8 return 0;9}