
{"id":1313,"date":"2023-09-27T20:15:25","date_gmt":"2023-09-27T18:15:25","guid":{"rendered":"https:\/\/elearning-jean-marc-ludkas.eu\/?page_id=1313"},"modified":"2023-09-27T20:16:00","modified_gmt":"2023-09-27T18:16:00","slug":"cours-algo","status":"publish","type":"page","link":"https:\/\/elearning-jean-marc-ludkas.eu\/?page_id=1313","title":{"rendered":"Cours ALGO"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"1313\" class=\"elementor elementor-1313\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a48ab20 elementor-section-boxed elementor-section-height-default elementor-section-height-default wpr-particle-no wpr-jarallax-no wpr-parallax-no wpr-sticky-section-no\" data-id=\"a48ab20\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b3b876c\" data-id=\"b3b876c\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-dde7316 elementor-widget elementor-widget-text-editor\" data-id=\"dde7316\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.15.0 - 20-08-2023 *\/\n.elementor-widget-text-editor.elementor-drop-cap-view-stacked .elementor-drop-cap{background-color:#69727d;color:#fff}.elementor-widget-text-editor.elementor-drop-cap-view-framed .elementor-drop-cap{color:#69727d;border:3px solid;background-color:transparent}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap{margin-top:8px}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap-letter{width:1em;height:1em}.elementor-widget-text-editor .elementor-drop-cap{float:left;text-align:center;line-height:1;font-size:50px}.elementor-widget-text-editor .elementor-drop-cap-letter{display:inline-block}<\/style>\t\t\t\t<section id=\"section1\"><h2>Exercice 1<\/h2><p>\u00c9crire un algorithme qui prend en entr\u00e9e une liste de nombres et retourne leur moyenne.<\/p><pre><code>\n                    Algo : moyenne \n                    D\u00e9claration \n                        tab: tableau[1..10] de entier\n                        s, i: entier\n                        m: reel\n                    D\u00e9but \n                        Pour i allant de 1 \u00e0 10 Faire\n                            afficher(\"Donner un entier\")\n                            saisir(tab[i])\n                        Fin Pour\n                        s &lt;- 0\n                        Pour i allant de 1 \u00e0 10 Faire\n                            s &lt;- s + tab[i]\n                        Fin Pour\n                        m &lt;- s\/10\n                        afficher(\"la moyenne du tableau est de \", m)\n                    Fin moyenne\n                <\/code><\/pre><\/section><section id=\"section2\"><h2>Exercice 2<\/h2><p>\u00c9crire un algorithme qui r\u00e9sout l&rsquo;\u00e9quation du type ax + b = 0 et affiche la solution.<\/p><pre><code>\n                    Algo : equation \n                    D\u00e9claration \n                        a, x, b: r\u00e9el\n                    D\u00e9but\n                        afficher(\"donner le premier coef\")\n                        saisir(a)\n                        afficher(\"donner le second coef\")\n                        saisir(b)\n                        si a = 0 \n                            alors si b=0\n                                    alors afficher(\"ensemble des solution est R\")\n                                    sinon afficher(\"ensemble des solutions est vide\")\n                                    fin si\n                            sinon \n                                x &lt;- -b\/a\n                                afficher(\"la solution est:\",x)\n                        fin si\n                    Fin equation\n                <\/code><\/pre><\/section><section id=\"section3\"><h2>Exercice 3<\/h2><p>\u00c9crire un algorithme qui d\u00e9termine si un nombre est parfait ou non.<\/p><pre><code>\n                    Algo : parfait\n                    D\u00e9claration \n                        n, s, i : entier\n                    D\u00e9but\n                        afficher(\"Donner un nombre : \")\n                        saisir(n)\n                        s&lt;-0\n                        pour i allant de 1 \u00e0 n-1 faire\n                            si n%i=0\n                                alors s&lt;-s+i\n                            fin si\n                        fin pour\n                        si n=s\n                            alors afficher(\"Votre nombre est parfait\")\n                            sinon afficher(\"Votre nombre n'est pas parfait\")\n                        fin si\n                    \n                    Fin parfait\n                <\/code><\/pre><\/section><section id=\"section4\"><h2>Exercice 4<\/h2><p>\u00c9crire un algorithme qui calcule le factoriel d&rsquo;un nombre donn\u00e9.<\/p><pre><code>\n                    Algo : calcul_fact\n                    D\u00e9claration \n                        Proc\u00e9dure factoriel(n:entier)\n                        D\u00e9claration\n                            fact, i: entier\n                        D\u00e9but\n                            fact &lt;- 1\n                            Pour i allant de 1 \u00e0 n Faire\n                                fact &lt;- fact*i \n                            Fin pour \n                            Afficher (\"le factoriel est de:\",fact)\n                        Fin factoriel\n                        nb: entier\n                    D\u00e9but\n                        Afficher (\"donner un entier\")\n                        Saisir (nb)\n                        factoriel (nb)\n                    Fin calcul_fact\n                <\/code><\/pre><\/section><section id=\"section5\"><h2>Exercice 5<\/h2><p>\u00c9crire un algorithme qui ouvre un fichier, affiche son contenu caract\u00e8re par caract\u00e8re, et compte le nombre total de caract\u00e8res.<\/p><pre><code>\n                    Algo : affiche_fichier\n                    D\u00e9claration \n                        f : fichier\n                        nom : chaine\n                        nb : entier\n                        c : caract\u00e8re\n                    D\u00e9but \n                        afficher (\"Donner le nom du fichier\")\n                        saisir(nom)\n                        f &lt;- ouvrir (nom,lecture)\n                        nb &lt;- 0\n                        tant que fin_fichier(f) = faux faire\n                            lire (f,c)\n                            afficher (c)\n                            nb &lt;- nb+1\n                        Fin tant que\n                        fermer (f)\n                        afficher (\"Ce fichier contient \",nb,\"caract\u00e8res\")\n                    \n                    Fin affiche_fichier\n                <\/code><\/pre><\/section>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Exercice 1 \u00c9crire un algorithme qui prend en entr\u00e9e une liste de nombres et retourne leur moyenne. Algo : moyenne D\u00e9claration tab: tableau[1..10] de entier s, i: entier m: reel D\u00e9but Pour i allant de 1 \u00e0 10 Faire afficher(\u00ab\u00a0Donner un entier\u00a0\u00bb) saisir(tab[i]) Fin Pour s &lt;- 0 Pour i allant de 1 \u00e0 10 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/elearning-jean-marc-ludkas.eu\/index.php?rest_route=\/wp\/v2\/pages\/1313"}],"collection":[{"href":"https:\/\/elearning-jean-marc-ludkas.eu\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/elearning-jean-marc-ludkas.eu\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/elearning-jean-marc-ludkas.eu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elearning-jean-marc-ludkas.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1313"}],"version-history":[{"count":4,"href":"https:\/\/elearning-jean-marc-ludkas.eu\/index.php?rest_route=\/wp\/v2\/pages\/1313\/revisions"}],"predecessor-version":[{"id":1317,"href":"https:\/\/elearning-jean-marc-ludkas.eu\/index.php?rest_route=\/wp\/v2\/pages\/1313\/revisions\/1317"}],"wp:attachment":[{"href":"https:\/\/elearning-jean-marc-ludkas.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}