Skip to content

Instantly share code, notes, and snippets.

@SwadhInz
Created August 20, 2015 17:59
Show Gist options
  • Save SwadhInz/2cc540210fd2e4dc3310 to your computer and use it in GitHub Desktop.
Save SwadhInz/2cc540210fd2e4dc3310 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main()
{
int line, t, n, k, sum, i, j;
scanf("%d", &n);
for(line = 1; line <= n; line++) {
for(i = 0; i < (n - line); i++)
printf(" ");
t = line - 1;
printf("%d", line);
for(k = 1; k <= t; k++) {
sum = line + k;
printf("%d", sum);
j = sum;
}
for(k =1; k <= t; k++) {
sum = j - k;
printf("%d", sum);
}
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment