Overblog Tous les blogs Top blogs Emploi, Enseignement & Etudes Tous les blogs Emploi, Enseignement & Etudes
Editer l'article Suivre ce blog Administration + Créer mon blog
MENU

Ce blog est fait pour aider à la compréhension des maths et ses mises en application dans différents langages de programmation ( Algobox, Python, calculatrice Ti83)

PPCM

**********************************************************************************************
Calcul du Plus Petit Commun Multiple.
Très utile notamment pour le calcul des dénominateur communs de fractions.
**********************************************************************************************

1   VARIABLES
2     a EST_DU_TYPE NOMBRE
3     b EST_DU_TYPE NOMBRE
4     k EST_DU_TYPE NOMBRE
5     n EST_DU_TYPE NOMBRE
6     c EST_DU_TYPE NOMBRE
7     d EST_DU_TYPE NOMBRE
8     e EST_DU_TYPE NOMBRE
9   DEBUT_ALGORITHME
10    LIRE a
11    LIRE b
12    k PREND_LA_VALEUR 1
13    n PREND_LA_VALEUR 2
14    c PREND_LA_VALEUR b
15    d PREND_LA_VALEUR a
16    SI (a<b) ALORS
17      DEBUT_SI
18      e PREND_LA_VALEUR a
19      a PREND_LA_VALEUR b
20      b PREND_LA_VALEUR e
21      FIN_SI
22    TANT_QUE (c!=d) FAIRE
23      DEBUT_TANT_QUE
24      c PREND_LA_VALEUR b*n
25      d PREND_LA_VALEUR a*k
26      SI (c>d) ALORS
27        DEBUT_SI
28        k PREND_LA_VALEUR k+1
29        FIN_SI
30        SINON
31          DEBUT_SINON
32          SI (c<d) ALORS
33            DEBUT_SI
34            n PREND_LA_VALEUR n+1
35            FIN_SI
36          FIN_SINON
37      
38      FIN_TANT_QUE
39    AFFICHER c
40  FIN_ALGORITHME
 

Retour à l'accueil
Partager cet article
Repost0
Pour être informé des derniers articles, inscrivez vous :
Commenter cet article