The code below counts how many letters you have in a word and multiplies by 0.01. The problem is that when a 10-letter word, for example, is entered, it has an output of 0.10 instead of 0.1.
import java.util.Scanner;
import java.text.DecimalFormat;
public class MedidaDeTempo{
public static void main(String[] args){
Scanner ler = new Scanner(System.in);
String teste;
int C, tamanho, i = 0;
double T;
C = ler.nextInt();
do{
i++;
teste = ler.nextLine();
tamanho = teste.length();
T = tamanho * 0.01;
if(T > 0.00){
DecimalFormat df = new DecimalFormat("0.##");
String decimal = df.format(T);
System.out.printf(decimal + "\n");
}
} while(i <= C);
}
}