how could printf be used to display a number of decimals according to a variable

0
int i = 3 ;
//esto puede ser cualquier valor, que va a cambiar segun parametros que yo de
double j = 23.65656846516844 // valor cualquiera con decimales
System.out.printf( " %.(i)f", j );

What I would like to do there would be to use a% .if being i a variable, how can I use that with% f? to print an arbitrary number of decimals

    
asked by jason martinez 14.06.2018 в 04:23
source

0 answers