Exercice somme entre 2 entiers

This commit is contained in:
Meutel 2019-06-17 17:37:53 +02:00
parent c02cfdbac6
commit 7843ea57c2

View File

@ -9,7 +9,20 @@ public class Somme2 {
} }
public static final int somme2(int n, int p) { public static final int somme2(int n, int p) {
return 0;
} if (n<=p){
int r=0;
for (int q=n; q<=p; q++){
r=r+q;
}
return r;
}
else {
return somme2(p,n);
}
}
} }