Last active
May 3, 2020 12:57
-
-
Save hxmwr/a54abe1452b5e6942820fe3536492469 to your computer and use it in GitHub Desktop.
print diamond pattern
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> | |
int main() | |
{ | |
char *str = " ************"; | |
for (int i = 0 i < 20; i++) printf("%.*s\n", i/4%2==0?i % 4 + 5:9-i%4, i/4%2==0?str + i % 4:str+4-i%4); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment