2. Función del Programa
ESTE PROGRAMA TIENE LA FUNCION DE
IDENTIFICAR SI EL NUMERO INGRESADO
TIENE 3, 2, O 1 DIGITO Y SI ES POSITIVO O
NEGATIVO.
3. Código
package segundoparcial;
import java.util.*;
public class Programa3 {
public static void main(String[] args) {
Scanner x = new Scanner(System.in);
int a,b;
System.out.println("ESTE PROGRAMA TIENE LA FUNCION DE IDENTIFICAR SI EL NUMERO
INGRESADO TIENE 3, 2, O 1 DIGITO Y SI ES POSITIVO O NEGATIVO");
do{
System.out.println("Ingresa un valor entre 0 y 999");
a=x.nextInt();
if(a>=100)
{
System.out.println("El numero tiene 3 digitos");
}
4. else
{
if (a>=10)
{
System.out.println("El numero tiene 2 digitos");
}
else
{
if (a>=0)
{
System.out.println("El numero tiene un digito");
}
else
{
System.out.println("El numero es negativo");
}
}
}
System.out.println("¿Quieres repetir el programa? 1=si/0=no");
b=x.nextInt();