CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

resulting types:

  • if two operands are integers, the result is integer:
    • example: 1/3 ... the result is 0
  • if both operands are float, the result is float; if one is int and other is float, the int is converted to a float before the operation.
    • example: 1/3. ... the result is 0.333...
  • if you assign a float value to a integer, the float will be converted to integer and the decimal part is lost.
    • example: i= 5.95 ... means that, if i is integer, its value will be 5
  • if operands have same priority, evaluation is performed from left to right.
    • example: 1/3*3 ... is zero; 1*3/3 is one.