Arithmetic/Integer: Difference between revisions
Content added Content deleted
imported>Brie (Add Nu) |
(Added Dart) |
||
Line 1,501: | Line 1,501: | ||
}</syntaxhighlight> |
}</syntaxhighlight> |
||
Division and modulus are defined as in C99. |
Division and modulus are defined as in C99. |
||
=={{header|Dart}}== |
|||
<syntaxhighlight lang="dart">import 'dart:io'; |
|||
import 'dart:math' show pow; |
|||
void main() { |
|||
print('enter a integer: '); |
|||
int a = int.parse(stdin.readLineSync()); |
|||
print('enter another integer: '); |
|||
int b = int.parse(stdin.readLineSync()); |
|||
print('a + b = ${a + b}'); |
|||
print('a - b = ${a - b}'); |
|||
print('a * b = ${a * b}'); |
|||
print('a / b = ${a ~/ b}'); |
|||
print('a % b = ${a % b}'); |
|||
print('a ^ b = ${pow(a, b)}'); |
|||
//Integer division uses the '~/' operator |
|||
}</syntaxhighlight> |
|||
=={{header|dc}}== |
=={{header|dc}}== |