cours-info/Somme.java

23 lines
322 B
Java
Raw Permalink Normal View History

2019-05-30 15:35:18 +00:00
import static utils.Utils.*;
public class Somme { // FIXME A CHANGER
public static final void main(String[] args) {
int n=3;
afficher("Somme", n, somme(n));
}
public static int somme(int n){
int result = 0;
for(int i = 0; i <= n; i++){
result = i+result;
}
return result;
}
}