Choosing number problem

import java.util.;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
float n = scan.nextFloat();
float ans = (n
9)/100;
System.out.println(ans);

}

}

// test case not clear but conmpile time ans come

you have to print A float denoting the answer upto 2 decimal point accuracy.add that

please help me for this question

You can use the printf method, like so:

System.out.printf("%.2f", ans);

In short, the %.2f syntax tells Java to return your variable ( val ) with 2 decimal places ( .2 ) in decimal representation of a floating-point number ( f ) from the start of the format specifier ( % ).

There are other conversion characters you can use besides f :

  • d : decimal integer
  • o : octal integer
  • e : floating-point in scientific notation

if this solves your doubt please mark it as resolved :slight_smile: