GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Example/Example/src/ModDemo.java at master · ResilientSpring/Example

Expand file tree

/

ModDemo.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
55 lines (36 loc) · 1.8 KB
/

ModDemo.java

Copy path

File metadata and controls

55 lines (36 loc) · 1.8 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
public class ModDemo {
public static void main(String[] args) {
// TODO Auto-generated method stub
double truncated = 10.5 / 1.2 ;
System.out.println("When / is applied to a non-integer: 10.5 / 1.2 = " + truncated);
System.out.println();
int truncated2 = 10 / 3 ;
System.out.println("When / is applied to an integer, any remainder will be truncated: 10 / 3 = " + truncated2);
System.out.println();
int truncated3 = 10 % 3 ;
System.out.println("You can obtain the remainder of this division by using the modulus operator %: 10 % 3 = " + truncated3);
System.out.println();
double truncated4 = 10.0 % 3.0 ;
System.out.println("The % can be applied to both integer and double types. Thus, 10.0 % 3.0 = " + truncated4);
System.out.println();
float truncated5 = (float) (10.0 % 3.0) ;
System.out.println("The % can be applied to both integer and floating-point types. Thus, 10.0 % 3.0 = " + truncated5);
System.out.println();
int iresult, irem;
double dresult, drem;
iresult = 10 / 3 ;
irem = 10 % 3 ;
dresult = 10.0 / 3.0 ;
drem = 10.0 % 3.0 ;
System.out.println("Result and remainder of 10 / 3: " + iresult + " " + irem);
System.out.println("Result and remainder of 10.0 / 3.0: " + dresult + " " + drem);
/**
* In mathematics, the remainder is the amount "left over" after performing some computation.
* In arithmetic, the remainder is the integer "left over" after dividing one integer by another to produce an integer quotient (integer division).
* In algebra, the remainder is the polynomial "left over" after dividing one polynomial by another.
* The modulo operation is the operation that produces such a remainder when given a dividend and divisor.
*
* Source: https://en.wikipedia.org/wiki/Remainder
* */
}
}
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.