加算
Python
| サンプル | 実行結果 |
|
print 12+34 print 11.2+0.3 print 11.0+3 |
46 11.5 14.0 |
JavaScript
| サンプル | 実行結果 |
| document.write(12.3 + 56.7); | 69 |
減算
Python
| サンプル | 実行結果 |
|
print 12-34 print 11.2-0.3 print 11.0-3 |
-22 10.9 8.0 |
JavaScript
| サンプル | 実行結果 |
| document.write(12.3 - 56.7); | -44.400000000000006 |
乗算
Python
| サンプル | 実行結果 |
|
print 12*34 print 11.2*0.3 print 11.0*3 |
408 3.36 33.0 |
JavaScript
| サンプル | 実行結果 |
| document.write(12.3 * 56.7); | 697.4100000000001 |
除算
Python
| サンプル | 実行結果 |
|
print 12/34 print 11.2/0.3 print 11.0/3 print 1/0 |
0 37.3333333333 3.66666666667 Traceback (most recent call last): File "/Users/Python/calc/004/sample1/sample.py", line 5, in ? print 1/0 ZeroDivisionError: integer division or modulo by zero |
JavaScript
| サンプル | 実行結果 |
| document.write(12.3 / 56.7); | 0.21693121693121692 |