-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit for C - More functions, more nested loops
- Loading branch information
1 parent
9534114
commit 9880b67
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "main.h" | ||
|
||
/** | ||
* main - check the code | ||
* | ||
* Return: Always 0. | ||
*/ | ||
int main(void) | ||
{ | ||
print_line(0); | ||
print_line(2); | ||
print_line(10); | ||
print_line(-4); | ||
return (0); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "main.h" | ||
|
||
/** | ||
* print_line - printing lines with underscore | ||
* @n: number of times underscore is printed | ||
* | ||
* Return: void | ||
*/ | ||
|
||
void print_line(int n) { | ||
if (n <= 0) { | ||
_putchar('\n'); | ||
} else { | ||
int i; | ||
for (i = 0; i < n; i++) { | ||
_putchar('_'); | ||
} | ||
_putchar('\n'); | ||
} | ||
} |
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