Created
March 20, 2020 15:37
-
-
Save Silva97/54f72ab5097c95d0baf87809b971c182 to your computer and use it in GitHub Desktop.
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
void triangle(int, int); | |
int main(int argc, char **argv) | |
{ | |
triangle(atoi(argv[1]), 0); // 17 | |
return 0; | |
} | |
void triangle(int times, int indentation) | |
{ | |
if (times <= 0) | |
return; | |
if (indentation > 0) | |
printf("%*c", indentation, ' '); | |
for (int i = 0; i < times; i++) | |
putchar('*'); | |
putchar('\n'); | |
triangle(times-2, indentation+1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment