In the following code below, i am asked what will print on the screen in the question, i guessed it would display 23 and below on a new line 11.5 cause that's 23 / 2. Then i remembered that integers are only whole numbers so i decided to build and run anyways and it gave me, 23 and below it 1. Why did it give me the 1 ?
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
usingnamespace std;
int main()
{
int a, b = 23;
a = b % 2;
cout << b << endl << a << endl;
system("pause");
return 0;
}