Write a Dart program to swap two numbers.

Code:

void main() {
  var a = 7;
  var b = 10;
  print('a= $a');
  print('b= $b');
  var temp = a;
  a = b;
  b = temp;
  print('a= $a');
  print('b= $b');
}


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