Determine the output of the following program: integer truncation - C++ Operator

C++ examples for Operator:Arithmetic Operator

Description

Determine the output of the following program: integer truncation

Demo Code

#include <iostream>
using namespace std;
int main()  // a program illustrating integer truncation
{
   cout << "answer1 is the integer " << 9/4;
   cout << "\nanswer2 is the integer " << 17/3;
   return 0;//ww  w  .j a  v a 2 s.  c  om
}

Result


Related Tutorials