/*Write a program in C to print the following pattern: 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 3 4 5 4 3 2 1 */ #include int main () { int n, i, j, k, l; printf ("\nEnter the total number of lines: "); scanf ("%d", &n); for (i=1; i<=n; i++) //outer loop i => maintains line no. { printf ("\n"); for (j=1; j<=n-i; j++) //inner loop j => nos. in each line { printf (" "); //placed 2 bar space after each no. } for (k=1; k<=i; k++) printf ("%d ", k); /*Till here left side of the pattern will be printed*/ for (l=i-1; l>=1;l--) //prints the right half of the pattern printf ("%d ", l); } return 0; }