Bonjour,

Je suis débutant sous emacs et sur ubuntu et nouveau également dans le domaine de la programmation, je fais de mon mieux pour faire un exercice, voilà ce que j'ai fait :

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
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class Echo{
    public static String echo(int attenuation, String mot){
	String res="";
	int n= mot.length();
	int dif= n-attenuation;
 
	if ( dif < 0 )
	    return "<"+mot+">";
 
	System.out.print("<"+mot);
 
	while ( dif > 0 )
	    { 
	    for(int i=0; i< dif ; i++)
		{
		res=res+ mot.charAt(i);
		}
	    dif= res.length()- attenuation;
	    System.out.print(res);
	    }
	System.out.print(">");
	return "";
 
    }
    public static void main(String[] args){
	String mot= new String(args[0]);
	int attenuation=Integer.parseInt(args[1]);
	String a = echo(attenuation,mot);
	System.out.println(a);
    }
}
le but serai donc de faire en sorte que si je fais "java Echo programmation2 4" le programme me sorte:
>programmation2programmatprograp>

j'arrive pas à le faire, je crois que j'ai un problème au niveau du while, pouvez vous m'aider s'il vous plait ?
cordialement