Write a Dart program to that takes three numbers(x,y,z) as input and print the output of (x+y).z and x.y + y.z.
Code:
import 'dart:io';
void main() {
print('Input first number : ');
int x = int.parse(stdin.readLineSync());
print('Input second number : ');
int y = int.parse(stdin.readLineSync());
print('Input third number : ');
int z = int.parse(stdin.readLineSync());
print('(x+y)*z = ${(x + y) * z}');
print('x*y + y*z = ${(x * y) + (y * z)}');
}
Output:
Comments
Post a Comment