0
1
Write a program that read a number with 4 digits from the user and determine if it is octal or no??
1 Respuesta
+ 1
int x = in.nextInt();
if(x>=1000 && x<=9999)
String xs = x.toString();
if(xs.contains("8") || xs.contains("9"))
System.out.print("The number "+x+" is not octal");
else
System.out.print("The number "+x+" is octal");
else
System.out.println("Write a valid number of 4 digits");
//This should work xD