Java débutant: boucles
Résolu/Fermé
Moody
-
Modifié par Moody le 8/11/2011 à 01:19
KX Messages postés 16734 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 24 avril 2024 - 1 nov. 2012 à 16:55
KX Messages postés 16734 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 24 avril 2024 - 1 nov. 2012 à 16:55
A voir également:
- Java débutant: boucles
- Waptrick java football - Télécharger - Jeux vidéo
- Java apk - Télécharger - Langages
- Jeux java itel football - Télécharger - Jeux vidéo
- Java jre - Télécharger - Langages
- Jeux java itel 5360 ✓ - Forum Mobile
1 réponse
KX
Messages postés
16734
Date d'inscription
samedi 31 mai 2008
Statut
Modérateur
Dernière intervention
24 avril 2024
3 015
8 nov. 2011 à 07:03
8 nov. 2011 à 07:03
println(String) affiche les éléments et passe à la ligne, toi ce dont tu as besoin c'est de print(String) qui affiche les éléments mais sans passer à la ligne.
8 nov. 2011 à 07:34
Tu dupliques la méthode vertical(int a) que tu nommeras par exemple horizontal(int a) mais tu supprimes le nl de printnl pour avoir les 3 * sur une ligne.
8 nov. 2011 à 07:37
8 nov. 2011 à 15:10
class horizontal{
public static void horizontal(int a){
for(int i=1; i<=a; i++){
System.out.print("*");
}
}
public static void main(String[] args){
int a;
Scanner sc = new Scanner(System.in);
System.out.println("Entrez un entier");
a = sc.nextInt();
horizontal(a);
}
}
8 nov. 2011 à 19:52
9 nov. 2011 à 15:14
Cdlt