Search C Program

Number Pattern - 13

12345
4321
123
21
1

int main()
{
    int i,j,k;
    for(i=5;i>=1;i--)
    {
        if(i%2==1) k=1;
        else k=i;
        for(j=1;j<=i;j++)
        {
            printf("%d",k);
            if(i%2==1) k++;
            else k--;
        }
        printf("\n");
    }
    return 0;
}


Related Links:
- More Number Pattern Programs
- Star Pattern Programs in C
- Alphabet Pattern Programs in C
- Series Programs in C


10 comments:

  1. #include
    int main()
    {
    int i, j;
    for(i=5; i>=1; --i)
    {
    for(j=1; j<=i; ++j)
    {
    printf("%d", j);
    }
    printf("\n");
    for(j=i-1; j>=1; --j)
    {
    printf("%d", j);
    }
    --i;
    printf("\n");
    }
    return 0;
    }

    ReplyDelete
  2. #include
    #include
    int main()
    {
    int row,i,;
    for(row=5;row>=1;row--)
    {
    if(row%2==0)
    {
    //printf(" ");
    for(i=row;i>=1;i--)
    {
    printf("%d",i);
    }
    }
    else
    {
    for(i=1;i<=row;i++)
    {
    printf("%d",i);
    }
    }
    printf("\n");
    }
    getch();
    return 0;
    }

    ReplyDelete
  3. for(i=0;i<=5;i++){
    if(i%2==0){
    for(j=1;j<=5-i;j++){
    printf ("%d",j);
    }
    }
    else{
    for(j=5-i;j>=1;j--){
    printf ("%d",j);
    }
    }
    printf ("\n");
    }
    return 0;
    }

    ReplyDelete

  4. #include
    #include

    void main()
    { clrscr();
    int i,j,k;
    for(i=5;i>=1;i--)
    { if(i%2==1)
    { for(j=1;j<=i;j++)
    printf("%d",j); }
    else
    { for(j=i;j>=1;j--)
    printf("%d",j); }

    printf("\n");
    }
    getch();
    }

    ReplyDelete
  5. m=6,n=4;
    for(i=1;i<6;i++)
    {
    for(j=1;j0;k--)
    {
    printf("%d",k);
    }
    n -=2;
    printf("\n");

    }

    ReplyDelete
  6. int main()
    {
    int i, j;
    for(i=5; i>=1; --i)
    {
    for(j=1; j<=i; ++j)
    {
    printf("%d", j);
    }
    printf("\n");
    for(j=i-1; j>=1; --j)
    {
    printf("%d", j);
    }
    i--;
    printf("\n");
    }
    return 0;
    }

    ReplyDelete
  7. Int main ()
    {
    Int I, j;
    For(i=1;i<=5;i++)
    {
    For(j=1;j<=6-i;j++)
    {
    If(i%2==0)
    {
    Printf ("%d", j) ;
    }
    Else
    {
    Printf("%d", 7-i-j);
    }
    Printf ("\n") ;
    }
    Return 0 ;
    }

    ReplyDelete
  8. int main()
    {
    for(i=1;i<=5;i++)
    {
    if(i%2==1)
    {
    for(j=1;j<=i;j++)
    printf("%d",j);
    }
    else
    {
    for(j=n-i+1;j>=1;j--)
    printf("%d",j);
    }
    }

    ReplyDelete
  9. #include
    #include
    void main()

    {
    int i, j;
    for(i=5;i>=1;i--)
    {
    if(i%2 != 0)
    {
    for(j=1;j<=i;j++)
    {
    printf("%d",j);
    }
    printf("\n");
    }
    else
    {
    for(j=i;j>=1;j--)
    {
    printf("%d",j);
    }
    printf("\n");
    }
    }

    getch();


    }

    ReplyDelete
  10. #include

    int main()
    {
    int r,i,j;

    printf("Enter the number of rows : ");
    scanf("%d",&r);

    for(i=r;i>=1;i--)
    {
    for(j=1;j<=i;j++)
    {
    if(i%2)
    {
    printf("%d ",j);
    }
    else
    {
    printf("%d ",i-j+1);
    }
    }
    printf("\n");
    }

    return 0;
    }

    ReplyDelete