HoussemNa12

DivisibilitéPar31

Jun 5th, 2020
367
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Program divisibolitePar31;
  2. Uses Wincrt;
  3.  
  4. var
  5.     n:integer;
  6.    
  7. Function isDivsibleBy31(n : Integer) : Boolean;
  8. Begin
  9.   While (n > 31) Do
  10.     Begin
  11.         n := (n div 10) - 3 * (n mod 10);
  12.     End;
  13.  
  14.         isDivsibleBy31 := (n = 0);
  15. End;
  16. Begin
  17.  
  18. writeln(isDivsibleBy31(31 * 5 + 1));
  19.  
  20. End.
RAW Paste Data