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

Popular posts from this blog

Write a Dart program to convert from celsius degrees to Kelvin and Fahrenheit.

Write a Dart program to check two given integers and return true if one is negative and one is positive

Write a Dart program to compute the sum of two given integers, if two values are equal then return the triple of their sum