quiz1b - ints

Name ________________________________     Date _________

Determine the output.  Show your work.

#include <iostream.h>
main()
{

   int num1, num2; //Declaring integer variables
   float f1, f2; // Declaring float variables
   cout << "please enter a number : ";
    cin >> num1; //enter the number 4
    cout << num1 << "**\n";
    cout << float(num1) << "##\n";
    num2 = num1 + 5.2;
    cout <<"num2 = "<< num2 <<'\n';
    f2 = num1 + 5.2;
    cout << "f2 = " << f2 << '\n';
    cout <<"integer division "<< 12 / num1 << '\n';
     //An integer is casted into a float in the next line.
    cout <<"real division " << 9 / float(num1) << '\n';
    f1 = 7.2;
    cout << "f1 = " << f1 << '\n';
    cout << "f1 casted = " << int(f1) << '\n';
    return 0;
}

OUTPUT                                                                WORK
please enter a number : 4
4**
4##
num2 = 9
f2 = 9.2
integer division 3
real division 2.25
f1 = 7.2
f1 casted = 7