0

1

Write a program that read a number with 4 digits from the user and determine if it is octal or no??

6th Mar 2018, 8:29 PM
aideh
aideh - avatar
1 Resposta
+ 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
9th Mar 2018, 9:51 PM
jaaxdev
jaaxdev - avatar