A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

1 11 121 12312341 ...Pattern Programming in C

Program:

#include<stdio.h>
#include<conio.h>
int main()
{
   int i,j,k,a,n,s,p;
   printf("Enter the no. of lines:");
   scanf("%d",&n);
   a=n;
   j=1;
for(i=1;i<=n;i++)
{
    for(k=1;k<=(a-1);k++)
        printf(" ");
    a--;
    for(k=1,p=1;k<=(i-1);)
    {
        if((!(k%10)^0))
            p=0;
        printf("%d",p);
        k++;p++;
    }
    if(!((i%10)^0))
        j=0;
    printf("%d",j);
    s=--p;
    if(i>10)
    {
        for(s>0;s--;)
            printf("%d",s);
        printf("\n");
    }
    getch();
}
}


Output:



Now, press Enter

Now, press Enter

Now, press Enter

Now, press Enter


LEARN TUTORIALS

.

.