Home » Sometech » WAP to diaplay n lines of the pattern. 1 1 12 21 123 321 1234321

WAP to diaplay n lines of the pattern. 1 1 12 21 123 321 1234321

#include <stdio.h>

#include <conio.h>

void main()

{

                 int n,i,j,k,l,m;

                clrscr();

                printf(“\nEnter number of lines:”);

                scanf(“%d”,&n);

               for(i=1;i<=n;i++)

{

            for(j=1;j<=i;j++)

                       printf(“%2d”,j);

                  for(k=1;k<=(n-i);k++)

                       printf(”  “);

 

            for(l=1;l<=(n-i-1);l++)

                       printf(”  “);

            for(m=i;m>=1;m–)

{

if(m==n)

                       continue;

                       printf(“%2d”,m);

}

                  printf(“\n”);

    }

   getch();

}

Advertisements

SoME Tech

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

%d bloggers like this: