What will be the output of the following C++ code?

#include <iostream>
   using namespace std;
   int main()
   {
       int i = 3;
       int l = i / -2;
       int k = i % -2;
       cout << l << k;
       return 0;
   }

a) compile time error
b) -1 1
c) 1 -1
d) implementation defined

1 thought on “What will be the output of the following C++ code?”

Leave a Comment