Created
May 26, 2017 11:47
-
-
Save ishankhare07/5436d0221c885278d3486da7be5d1f1e to your computer and use it in GitHub Desktop.
star pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(star_pattern). | |
-export([print/2]). | |
for(N, N, Symbol) -> io:format("~s", [Symbol]); | |
for(X, N, Symbol) -> | |
io:format("~s",[Symbol]), | |
for(X, N-1, Symbol). | |
print(Symbol, Times) -> | |
start_print(Symbol, 1, Times). | |
start_print(Symbol, Times, Times) -> | |
for(1, Times, Symbol); | |
start_print(Symbol, Current, Times) -> | |
for(1, Current, Symbol), | |
io:format("~n"), | |
start_print(Symbol, Current+1, Times). |
Author
ishankhare07
commented
May 26, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment