Skip to content

Instantly share code, notes, and snippets.

@kantale
Created October 7, 2016 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kantale/adaa5b5eaf7df25741d752774773f2de to your computer and use it in GitHub Desktop.
Save kantale/adaa5b5eaf7df25741d752774773f2de to your computer and use it in GitHub Desktop.
#include <stdio.h>
/*
/A\
//A\\
///A\\\
\\\A///
\\A//
\A/
*/
int main() {
int N = 3;
int i, j;
//The top part
for (i=0; i<N; i++) {
// Spaces
for (j=0; j<N-i-1; j++) {
putchar(' ');
}
// Slash (/)
for (j=0; j<i+1; j++) {
putchar('/');
}
// A
putchar('A');
// Backslash (\)
for (j=0; j<i+1; j++) {
putchar('\\');
}
//New line
putchar('\n');
}
// The bottom part
for (i=0; i<N; i++) {
//Spaces
for (j=0; j<i; j++) {
putchar(' ');
}
// Backslash
for (j=N-i; j>0; j--) {
putchar('\\');
}
// A
putchar('A');
// Slash /
for (j=N-i; j>0; j--) {
putchar('/');
}
//New line
putchar('\n');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment