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

what is the relationship between the czech republic and slovakia in 1993
Select the correct answer from each drop-down menu. which word or phrase best completes the sentence? in the poem lift every voice and sing, james weldon johnso
Create an in-text citation for the following information. Be careful! Remember, your spacing and punctuation must be exact. page 126 of the book, The African Am
what is a secular government
how did the people of SE asia increase the productivity of the mountainous farmland? A. greenhouse B crowded flatland farming C. terrace farming (why do i kee
A writer, an illustrator, a publisher and an agent would form a ______.
please help me and answer fast too please
How can I be productive?
If A = [ 2 1 7 4 ] and B −1 = [ 3 −5 −1 2 ] then find (AB) −1
3x-4y=0 2x+y=110 no solution