In Java, how would I get a double to print out (output) to a certain number of d
ID: 3799504 • Letter: I
Question
In Java, how would I get a double to print out (output) to a certain number of decimal places? For example, 6 decimal places. As an example, how would I get the calculation of 05^-4 to print out as 0.500000^-4 = 16.000000 (scanner).
public static void main (String args) Scanner userkey new Scanner (System 1 n System out print Enter the base and exponent an integer of a power double user Base use rkey, next Double int userPow use rkey. nextInt if user Base 0 && user Pow 0) System out use rBase userPow '1 Double NaN else t if (use Base 0 && user Pow 0 0) printin (user Base II System out +user PowExplanation / Answer
hi i gave u an example to how you print the duble to 6 decimal palces...Since you not provide the code in text format ...so i am correcting your problem at this type...but i can provide the solution for this by following example:--
Hope it will help you.
Example:
gives the output:
if u got any problem please ask me by comment section...i will assist you on this...definitly.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.