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 :-)
 III  DDD   N   N  N   N  RRRR  
I D D NN N NN N R R
I D D N N N N N N RRRR
I D D N NN N NN R R
III DDD N N N N R RR