Skip to main content
added 143 characters in body
Source Link
cleblanc
  • 3.5k
  • 11
  • 16

#C, 47 46 45 43 bytes

Takes input from the command line

f(n){for(n&&f(n-1);~n;putchar(n--?42:10));} 
Basically if n is not 0 recurse on n-1. at the top of the recursion where n is 0 it just prints a newline, the for loop terminates when n is -1 or ~n is zero, otherwise it prints ASCII 42 which is '*'. Try it on [ideone][1]

#C++ 58 Bytes + 19 for including iostream is 77

#include<iostream> int f(int n){for(n&&f(n-1);~n;std::cout<<(n--?"*":"\n"));} 
main(c,v)char**v; { f(atoi(v[1])); } 
a.exe 3 * ** *** 

#C, 47 46 45 43 bytes

Takes input from the command line

f(n){for(n&&f(n-1);~n;putchar(n--?42:10));} 
Basically if n is not 0 recurse on n-1. at the top of the recursion where n is 0 it just prints a newline, the for loop terminates when n is -1 or ~n is zero, otherwise it prints ASCII 42 which is '*'. Try it on [ideone][1]
main(c,v)char**v; { f(atoi(v[1])); } 
a.exe 3 * ** *** 

#C, 47 46 45 43 bytes

Takes input from the command line

f(n){for(n&&f(n-1);~n;putchar(n--?42:10));} 
Basically if n is not 0 recurse on n-1. at the top of the recursion where n is 0 it just prints a newline, the for loop terminates when n is -1 or ~n is zero, otherwise it prints ASCII 42 which is '*'. Try it on [ideone][1]

#C++ 58 Bytes + 19 for including iostream is 77

#include<iostream> int f(int n){for(n&&f(n-1);~n;std::cout<<(n--?"*":"\n"));} 
main(c,v)char**v; { f(atoi(v[1])); } 
a.exe 3 * ** *** 
added 58 characters in body
Source Link
cleblanc
  • 3.5k
  • 11
  • 16

#C, 47 46 45 43 bytes

Takes input from the command line

f(n){for(n&&f(n-1);~n;putchar(n--?42:10));} 
Basically if n is not 0 recurse on n-1. at the top of the recursion where n is 0 it just prints a newline, the for loop terminates when n is -1 or ~n is zero, otherwise it prints ASCII 42 which is '*'. Try it on [ideone][1]
main(c,v)char**v; { f(atoi(v[1])); } 
a.exe 3 * ** *** 

#C, 47 46 45 43 bytes

Takes input from the command line

f(n){for(n&&f(n-1);~n;putchar(n--?42:10));} 
Basically if n is not 0 recurse on n-1. at the top of the recursion where n is 0 it just prints a newline, the for loop terminates when n is -1 or ~n is zero, otherwise it prints ASCII 42 which is '*'.
main(c,v)char**v; { f(atoi(v[1])); } 
a.exe 3 * ** *** 

#C, 47 46 45 43 bytes

Takes input from the command line

f(n){for(n&&f(n-1);~n;putchar(n--?42:10));} 
Basically if n is not 0 recurse on n-1. at the top of the recursion where n is 0 it just prints a newline, the for loop terminates when n is -1 or ~n is zero, otherwise it prints ASCII 42 which is '*'. Try it on [ideone][1]
main(c,v)char**v; { f(atoi(v[1])); } 
a.exe 3 * ** *** 
added 212 characters in body
Source Link
cleblanc
  • 3.5k
  • 11
  • 16

#C, 47 46 45 43 bytes

Takes input from the command line

f(n){for(n&&f(n-1);~n;putchar(n--?42:10));} 
Basically if n is not 0 recurse on n-1. at the top of the recursion where n is 0 it just prints a newline, the for loop terminates when n is -1 or ~n is zero, otherwise it prints ASCII 42 which is '*'.
main(c,v)char**v; { f(atoi(v[1])); } 
a.exe 3 * ** *** 

#C, 47 46 45 43 bytes

Takes input from the command line

f(n){for(n&&f(n-1);~n;putchar(n--?42:10));} 
main(c,v)char**v; { f(atoi(v[1])); } 
a.exe 3 * ** *** 

#C, 47 46 45 43 bytes

Takes input from the command line

f(n){for(n&&f(n-1);~n;putchar(n--?42:10));} 
Basically if n is not 0 recurse on n-1. at the top of the recursion where n is 0 it just prints a newline, the for loop terminates when n is -1 or ~n is zero, otherwise it prints ASCII 42 which is '*'.
main(c,v)char**v; { f(atoi(v[1])); } 
a.exe 3 * ** *** 
added 8 characters in body
Source Link
cleblanc
  • 3.5k
  • 11
  • 16
Loading
deleted 1 character in body
Source Link
cleblanc
  • 3.5k
  • 11
  • 16
Loading
added 28 characters in body
Source Link
acrolith
  • 4k
  • 1
  • 25
  • 41
Loading
added 7 characters in body
Source Link
cleblanc
  • 3.5k
  • 11
  • 16
Loading
Source Link
cleblanc
  • 3.5k
  • 11
  • 16
Loading