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

Sample Output:
Input first integer:
-5
Input second integer:
25
Check if one is negative and one is positive:
True

Code:

import 'dart:io';

void main() {
  stdout.write('Input first Number : ');
  int num1 = int.parse(stdin.readLineSync());
  stdout.write('Input Second Number : ');
  int num2 = int.parse(stdin.readLineSync());

  if (num1 != 0 && num2 != 0) {
    print(true);
  }
}


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 create a new string from a given string (length 1 or more ) with the first character added at the front and back.