Guest User

Untitled

a guest
Feb 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 0.38 KB | None | 0 0
  1. -module(test).
  2. -export([list_diviseur/1]).
  3.  
  4. list_diviseur(A) ->    
  5.     list_diviseur(A, 1).
  6.  
  7. list_diviseur(A, B) ->
  8.     case A rem B of
  9.         0 ->
  10.             io:format("==> ~p x ~p ~n", [B, trunc(A/B)]);
  11.         _ ->
  12.             next
  13.     end,
  14.     case  math:sqrt(A) < B of
  15.         true ->
  16.             ok;
  17.         false ->
  18.             list_diviseur(A, B+1)
  19.     end.
Add Comment
Please, Sign In to add comment