Ajouter un commentaire

tiger360

allez comme vous insisté
j vais qd meme mettre la solution
mais c est seulement pcq c est vous :wink: :

import java.util.Scanner ;
public class Ex5  {
         public static void main ( String[] args ) {
                  Scanner clavier = new Scanner ( System.in ) ;

                  int taille,nbr;
                  String chaine;
                  System.out.println("Introduisez la taille du tableau: ");
                  taille=clavier.nextInt();
                  int[] tab=new int[taille];

                  for (int i=0;i<tab.length;i++)
                  {
                                System.out.print("Introduisez un nombre: ");
                                nbr=clavier.nextInt();
                                tab[i]=nbr;
                  }
                  chaine=chaineTableau(tab);
                  System.out.println(chaine);
         }

         public static String chaineTableau (int[] tab)
         {
                  String chaine="";
                  for (int i=0;i<tab.length;i++)
                  {
                                chaine+=tab[i]+" ";
                  }
                  return chaine;
         }
}

Filtered HTML

Plain text

CAPTCHA
Cette question permet de vérifier que vous n'êtes pas un robot spammeur :-)
  GGG   L     K  K  M   M  N   N 
G L K K MM MM NN N
G GG L KK M M M N N N
G G L K K M M N NN
GGG LLLL K K M M N N