Bonsoir,
J'essaie de construire une chaîne de caractères qui donnerait :
Entrez une chaîne: Bzh
Bzh
BzhBzh
BzhBzhBzh
BzhBzhBzhBzh
BzhBzhBzhBzhBzh
BzhBzhBzhBzhBzhBzh
Voici le programme sur lequel je travail :
Je pense que c'est le reader que je ne maîtrise pas.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 import java.util.Scanner; public class essai { private static Scanner reader; public static void main(String[] args) { reader = new Scanner(System.in); double text ; int k = 0; System.out.print("Entrez une chaîne :"); text = reader.nextDouble(); for(int i=0; i<7 ;i++); for (int j=0; j<k;j++) System.out.print(text); System.out.println(); k++; } }
Merci encore pour votre coup de pouce.
Partager