Friday, May 7, 2021

Addition of Two Numbers in Dart

 In this tutorial, I will teach you how to write a simple addition of two numbers using Dart programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com





Program Listing

/* addition.dart
   Jake Rodriguez Pomperada, MAED-IT, MIT
   www.jakerpomperada.com   www.jakerpomperada.blogspot.com
   jakerpomperada@gmail.com
   Bacolod City, Negros Occidental Philippnes
*/
import 'dart:io';

void main() {
  stdout.write("\n");
  print("\tAddition of Two Numbers in Dart\n");

  stdout.write("Give First Value  : ");
  var input1 = stdin.readLineSync();

  stdout.write("Give Second Value : ");
  var input2 = stdin.readLineSync();
  stdout.write("\n");

  if (input1 != null && input2 != null) {
    var number1 = int.parse(input1);
    var number2 = int.parse(input2);

    var sum = (number1 + number2);
    print("The sum of $number1 and $number2 is $sum.\n");
  }

  print("\tEnd of Program\n");
}


No comments:

Post a Comment