Examveda

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

Answer: Option B


Join The Discussion

Related Questions on Variables and Data Types in C plus plus