Write a Dart program to compute the sum of two given integers, if two values are equal then return the triple of their sum
Code:
import 'dart:io';
void main() {
stdout.write('Input first Number : ');
int num1 = int.parse(stdin.readLineSync());
stdout.write('Input Second Number : ');
int num2 = int.parse(stdin.readLineSync());
if (num1 == num2) {
print((num1 + num2) * 3);
} else {
print(num1 + num2);
}
}
Output:
Comments
Post a Comment