id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

orion.a.smith@gmail.com apcsa-primitives > apcsaPrimitivesTrim
prev  |  next  |  chance

Given a double, return a String representation with the trailing ".0" removed if it's a whole number. Precondition: input will not contain any special double values.


apcsaPrimitivesTrim(42.0) → "42"
apcsaPrimitivesTrim(42.75) → "42.75"
apcsaPrimitivesTrim(0.0) → "0"

...Save, Compile, Run (ctrl-enter)

public String apcsaPrimitivesTrim(double num) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 140

Copyright Nick Parlante 2017 - privacy