Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class DoWhile {
- public static void main(String[] args) {
- Scanner teclado = new Scanner(System.in);
- int valor;
- do {
- System.out.print("Ingrese un valor entre 0 y 999 (0 finaliza): ");
- valor = teclado.nextInt();
- if (valor > 999) {
- System.out.println("Tiene más de 3 dígitos");
- System.out.println();
- }
- else if (valor >= 100 && valor <= 999) {
- System.out.println("Tiene 3 dígitos");
- System.out.println();
- }
- else {
- if (valor >= 10) {
- System.out.println("Tiene 2 dígitos");
- System.out.println();
- }
- else {
- System.out.println("Tiene 1 dígito");
- System.out.println();
- }
- }
- } while (valor != 0);
- System.out.println("Fin de CICLO");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement