How to round a floating-point number to an integer in Dart

1 Answer

0 votes
void main() {
  var x = 9382.4;
  var y = x.round();
  print("$y");
  
  x = 9382.5;
  y = x.round();
  print("$y");
}



 
/*
run:
 
9382
9383
 
*/

 



answered May 14, 2025 by avibootz
edited Jul 20, 2025 by avibootz

Related questions

1 answer 158 views
1 answer 131 views
131 views asked Oct 7, 2022 by avibootz
1 answer 152 views
1 answer 137 views
2 answers 220 views
...