diff --git a/Analyse1.java b/Analyse1.java new file mode 100644 index 0000000..a3d95ef --- /dev/null +++ b/Analyse1.java @@ -0,0 +1,38 @@ +import static utils.Utils.*; + +public class Analyse1 { + + public static final void main(String[] args) { + afficher("Analyse 1"); + + int[] tab1 = new int[] { 12, 0, 5, 21 }; + afficher("tab1:"); + maFonction(tab1); + + int[] tab2 = new int[] { 81, 13, 100, 4 }; + afficher("tab2:"); + maFonction(tab2); + + } + + public static void maFonction(int[] tab){ + + int m1 = 0; + int m2 = 0; + + for (int i = 0; i < tab.length; i++) { + int n = tab[i]; + + if (m1 < n) { + m2 = m1; + m1 = n; + } else if (m2 < n) { + m2 = n; + } + + } + afficher(m1); + afficher(m2); + } + +} diff --git a/Exercices.md b/Exercices.md index 33997eb..398df3d 100644 --- a/Exercices.md +++ b/Exercices.md @@ -135,6 +135,10 @@ Exemple: ## Exercice 9 +Que fait maFonction dans Analyse1.java? + +## Exercice 10 + Afficher la suite de Fibonacci. Il s’agit d’une suite de nombres dans laquelle tout nombre (à partir du troisième) est égal à la somme des deux précédents: @@ -145,13 +149,13 @@ Il s’agit d’une suite de nombres dans laquelle tout nombre (à partir du tro => Fibonacci.java -## Exercice 10 +## Exercice 11 Convertir un nombre romain en entier (avec "chiffre" romains I, V et X). => Romain.java -## Exercice 11 +## Exercice 12 Chiffre de César: @@ -159,7 +163,7 @@ Le texte chiffré s'obtient en remplaçant chaque lettre du texte clair original => CesarChiffre.java CesarDechiffre.java -## Exercice 12 +## Exercice 13 Tester si un mot est un palindrome. Un palindrome est un mot qui peut se lire dans les 2 sens: été, ici, colloc