Add Two Number

import 'dart:io'; // 1

main(List<String>args)
{
  print("Enter Two  Number");// 2
  var a = int.parse(stdin.readLineSync());//3
  var b = int.parse(stdin.readLineSync());//4
  var sum = a+b;//5
  print("Sum of $a+$b=$sum");//6

}

  1. import statement for input and out-stream lib for Dart
  2. Instruct to user enter two number
  3. Take input for First input and convert into int and assign to a
  4. Take input for Second input and convert into int and assign to b
  5. Add a and b then assign to the sum variable
  6. Show the result to the user on Command prompt

Output:-

Enter Two Number
40
35
Sum of 40+35=75

2 thoughts on “Add Two Number”

Leave a Reply

Your email address will not be published. Required fields are marked *