1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Scanner sc = new Scanner(System.in);
char tableau[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'};
char carac; char reponse; int i;
do
{
do // ligne 13
{
i = 0;
System.out.println("Entrez une lettre minuscule: ");
carac = sc.nextLine().charAt(0);
// while (i < tableau.length && carac != tableau[i]) // ligne 18
while (carac != tableau[i] && i < tableau.length) // ligne 19
i++;
// if(i < tableau.length) // ligne 21
if (carac != tableau[i]) // ligne 22
System.out.println("La lettre " + carac + " ne figure pas dans le tableau");
else
System.out.println("La lettre " + carac + " se trouve dans le tableau");
}
while(i >= tableau.length);
do
{
System.out.println("Voulez-vous continer?: O/N");
reponse = sc.nextLine().charAt(0);
}
while(reponse != 'O' && reponse != 'N');
}
while(reponse == 'O');
System.out.println("Bye Bye!!"); |
Partager