The idea is to receive a 4-digit number and then perform a variety of accounts but there is an entry condition: If in the middle of the 4 digits is a character other than a number then I need to print it.
No use of methods.
I can not make the following code:
Receive an example entry: 3? 56
-
Save {3,?, 5, 6} into an array without knowing what the entry is.
-
Check if any of the array positions are not between 0 and 9.
In this case? it is not a number then prints.
I wanted to store in the 4 positions of the array.
int i;
char [] digitos = new char[3];
digitos [0] =
digitos [1] =
digitos [2] =
digitos [3] =
for(i=0; i<digitos.length; i++);{
if(digitos[i]<(char)0||digitos[i]>(char)9) System.out.println("Digito "+digitos[i]+" invalido");
System.exit(0);