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 278 views
1 answer 213 views
213 views asked Oct 7, 2022 by avibootz
1 answer 241 views
1 answer 222 views
2 answers 362 views
...