fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. }
  14. }
Success #stdin #stdout 0.11s 52592KB
stdin
| a b stdout |
stdout := FileStream stdout.
FileStream stdin
	linesDo: [ :line |
		line isEmpty ifFalse: [
			(a isNil)
				ifTrue: [ a := line asNumber ]
				ifFalse: [ b := line asNumber ]
		]
	].

stdout
	nextPutAll: '和: '; nextPutAll: (a + b) printString; nl;
	nextPutAll: '差: '; nextPutAll: (a - b) printString; nl;
	nextPutAll: '積: '; nextPutAll: (a * b) printString; nl.

b = 0
	ifTrue: [
		stdout nextPutAll: 'ゼロで割ろうとしています'; nl
	]
	ifFalse: [
		stdout
			nextPutAll: '商: '; nextPutAll: (a / b) printString; nl;
			nextPutAll: '剰余: '; nextPutAll: (a \\ b) printString; nl.
	].

stdout flush.
stdout
Standard output is empty