Header Ads Widget

Ticker

6/recent/ticker-posts

WAP to input number and find pattern 1 21 321 4321 from left

 #include<stdio.h>

void main()

{

    int i,j,n;

    printf("Enter no. of pattern you want : ");

    scanf("%d",&n);

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

    {

        for (j=n;j>=1;j--)

        {

           if (j<=i)

            printf("%d",j);

            else

             printf(" ");

        }


    printf("\n");

    }


}

/* output


         1

         21

        321

     4321 */






Post a Comment

0 Comments