jenner4338 jenner4338
  • 20-08-2019
  • Computers and Technology
contestada

What is the output of the code below?

double num = 56.4321;
System.out.printf("%.2f", 56.4321);

%.2f
%.2f56.4321
56.43
56.4321

Respuesta :

Mustela Mustela
  • 24-08-2019

Answer:

The output of the given code is 56.43

Explanation:

As the code is given in java language the following are the code

public class code

{

public static void main(String[] args)

{

double num = 56.4321;

System.out.print("%.2f", 56.4321);

}

}

The %f means that it print the floating point number and .2 means that it print the first two digit of the given number after the point .

so " %.2f "means that it print the value first 2 digit of floating point number after the point .

Therefore it print 56.43

Answer Link

Otras preguntas

NEED HELP NOW PLEASE HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 20 PTS Match the italicized pronoun to the type. 1. Hand me THOSE papers. possessive 2. They call
Jill is lookig for the latest research to prepare her biology paper. Which type of online text source should she use?
When did Europeans explorers begin arriving in Canada?
Arianna correctly simplified an expression. When she substituted x= 2 into the simplified expression, the value was –4. Which could be Arianna’s original expr
Wha produce digestive juice that helps breaks down food
GUYS SUPER IMPORTANT 80 POINTS!!!! describe two charecteristicts of the indius river valley
factor completely xy-5x+2y-10
Help me please on this math
Max and his friend Zeke are comparing their ages. They figure out that if they double Max's age from 3 years ago and add it to Zeke's current age , the sum is 2
Five more than twice a number is 7