Guest User

MiBasic

a guest
Feb 17th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. FUNCTION faculty(zahl IS INTEGER) IS INTEGER
  2.     # Zahl ist nur für 32 bit integer
  3.     WITH zahl >= 0, zahl <= 12
  4.     # Rückgabewert ist immer größer 0
  5.     WITH $ > 0
  6. IMPLEMENTATION IS
  7.     IF zahl <= 1 THEN
  8.         # Die Fakultät von 0 und 1 ist als 1 definiert.
  9.         return 1;
  10.     ELSE
  11.         return faculty(zahl - 1) * zahl;
  12.     END
  13. END
Advertisement
Add Comment
Please, Sign In to add comment