Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------------------
- -- * ppcm.adb
- -- * Role : trouver le PPCM de deux nombres.
- ----------------------------------------------------------------
- with entrees_sorties; use entrees_sorties;
- procedure ppcm is
- nb1, nb2 : Integer;
- multiplieur : Integer;
- ppcm : Integer;
- begin
- ppcm := -1;
- multiplieur := 1;
- put("a ? ");
- get(nb1);
- new_line;
- put("b ? ");
- get(nb2);
- new_line;
- if(nb1 <= 0 OR nb2 <=0) then
- ppcm := 0;
- end if;
- while(ppcm < 0) loop
- if(((nb1*multiplieur) mod nb2) = 0) then
- ppcm := nb1*multiplieur;
- end if;
- multiplieur := multiplieur + 1;
- end loop;
- put("PPCM(");
- put(nb1, 0);
- put(", ");
- put(nb2, 0);
- put(") = ");
- put(ppcm, 0);
- end ppcm;
Advertisement
Add Comment
Please, Sign In to add comment