Write a Dart program to print on screen the output of adding, subtracting, multiplying and dividing of two numbers which will be entered by the user.
Code:
import 'dart:io';
void main() {
print('Input first Number : ');
int a = int.parse(stdin.readLineSync());
print('Input Second Number : ');
int b = int.parse(stdin.readLineSync());
int result = a + b;
print('$a + $b : $result');
result = a - b;
print('$a - $b : $result');
result = a * b;
print('$a x $b : $result');
result = (a / b).round();
print('$a / $b : $result');
}
Output:
Comments
Post a Comment