From 53b21a837a37e8367ff631224b8d7a4016b5607e Mon Sep 17 00:00:00 2001 From: Meutel Date: Thu, 30 May 2019 17:35:18 +0200 Subject: [PATCH] Exo somme --- Somme.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Somme.java diff --git a/Somme.java b/Somme.java new file mode 100644 index 0000000..521fafb --- /dev/null +++ b/Somme.java @@ -0,0 +1,22 @@ +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; + } + +}