Taking Inputs from User and perform Addition, Subtraction, Multiplication, Division

 import "dart:io";


/// First Way as shown below
// void main() {
// var num1,num2,total,total1,total2,total3;
// print("Please Enter Number 1: ");
// num1 = stdin.readLineSync();
// print("Please Enter Number 2: ");
// num2 = stdin.readLineSync();
// total = (int.parse(num1) + int.parse(num2));
// total1 = (int.parse(num1) - int.parse(num2));
// total2 = (int.parse(num1) * int.parse(num2));
// total3 = (int.parse(num1) / int.parse(num2));
// print(total);
// print(total1);
// print(total2);
// print(total3);
// }

/// Second Way as shown below
void main() {
var num1,num2,total,total1,total2,total3;
print("Please Enter Number 1: ");
num1 = int.parse(stdin.readLineSync()!);
print("Please Enter Number 2: ");
num2 = int.parse(stdin.readLineSync()!);
total = (num1 + num2);
total1 = (num1 - num2);
total2 = (num1 * num2);
total3 = (num1 / num2);
print(total);
print(total1);
print(total2);
print(total3);
}

Comments

Popular posts from this blog

Second GET API Calling with Bloc simple Example in Flutter

Stack Container Scrollable Card widget UI with Custom Widget

Pagination with Bloc Pattern in Flutter