Skip to content

Instantly share code, notes, and snippets.

@xy4n
Created October 23, 2015 19:22
Show Gist options
  • Save xy4n/a7705fa63ccebafc1629 to your computer and use it in GitHub Desktop.
Save xy4n/a7705fa63ccebafc1629 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[]) {
if(argc < 2)
return 1;
int i, j;
char* str = argv[1];
for(i = 0; i < (2*strlen(str)-1); i++) {
if (i<strlen(str)) {
int n;
for(n = 1; n<(strlen(str)-i); n++)
printf(" ");
}
for(j = 0; j < strlen(str); j++) {
if((i-j) < strlen(str)) {
printf("%c ", str[j]);
}
}
putchar('\n');
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment