The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.
Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by Aryana Ruiz, 2017-05-22 11:47:53

Technical Book

Technical Book

Dividing and Remainders

By: Janelle Ovalle, Aryana Ruiz, James Curd, Nicholas Regalado

Example 1:

System.out.println(int(5/3));
System.out.println((int) 5/3);
System.out.println((int)(5/3));

This outputs the integer 1

Example 2:

System.out.println(int(5%3));
System.out.println((int) 5%3);
System.out.println((int)(5%3));

This outputs the integer 2

Example 3:

System.out.println((int)(7/3));
System.out.println(7/3);
System.out.println((int)7/3);

This outputs the integer 1

Example 4:

System.out.println(int)(7%3);
System.out.println(7%3);
System.out.println((int)(7%3));

This outputs the integer 1

Example 5:

System.out.println(double (5.0/3.0));
System.out.println((double)5.0/3.0);
System.out.println((double)(5.0/3.0));

This outputs the double 1.66

Example 6:

System.out.println(double (5.0%3.0));
System.out.println((double)5.0%3.0);
System.out.println((double)(5.0%3.0));

This outputs the double 2.0

Example 7:

System.out.println((double)7.0/3.0);
System.out.println(double)(7.0/3.0));
System.out.println(double)(7.0/3.0);

This outputs the double 2.33

Example 8:

System.out.println(double (7.0%3.0));
System.out.println((double)7.0%3.0);
System.out.println(double)(7.0%3.0);

This outputs the double 1.0


Click to View FlipBook Version