+ 1
Why some cases still doesn't work?
//Code import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); float rest; rest = (float)amount; for(int r= 0; r<6; r++){ rest -= rest/10 ; } System.out.println((int)rest); } }
2 Respostas
+ 5
Saad Take amount as double and do
for (int i = 0; i < 6; i++)
amount = amount - Math.ceil(amount / 10);
System.out.println((int) amount);
0
Done it