3 Answers

  1. Quentin- Reply

    2019-11-15

    The first one is an integer division really. It divides an integer by another integer (the result of which is again an integer) and assigns the result to a double variable.

    Only the second one yields a double as result.

    integer / integer => result is integer, even though assigned to a double variable
    integer or double / double => result is double
    
  2. Randall- Reply

    2019-11-15

    first example will divide integers and assign them to your double "z", second divides doubles in the first place

  3. Randolph- Reply

    2019-11-15

    Integer/Integer is an Integer even if you assign it to a holder variable of type double.To get a double precision value,you need to do your arithmetic operations using double variables

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>