Search C Program

Number Pattern - 28

0 
909 
89098 
7890987 
678909876 
56789098765 
4567890987654 
345678909876543 
23456789098765432 
1234567890987654321 

#include<stdio.h>

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


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


5 comments:

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

    ReplyDelete
  2. class pat
    {
    public static void main(String args[])
    { int n=1, temp=10;
    for(int i=1; i<=10; i++)
    {
    for(int j=1; j<=n; j++)
    {
    if(i==j)
    {
    System.out.print("0");
    }
    else
    {
    if(j>i)
    {
    temp--;
    System.out.print(+temp);
    }
    else
    {
    System.out.print(+temp);
    temp++;
    }
    }
    }
    n=n+2;
    temp--;
    System.out.println("");
    }
    }
    }

    ReplyDelete
  3. public class voice {
    public static void main(String[] args){

    Scanner abhi=new Scanner(System.in);
    int i,j,k=1,l=1;
    for(i=0;i<=9;i++){

    for(j=10-i;j<=10+i;j++){

    if(j<=9){
    l=j;
    System.out.print(l);
    l++;
    }
    else if(j==10)
    System.out.print(0);
    else{
    l--;
    System.out.print(l);

    }
    }
    System.out.println();
    }

    }

    }

    ReplyDelete
  4. void main()
    {
    int i, j,k;
    for(i=1;i<=10;i++)
    {
    k=11-i;
    for(j=1;j<=2*i-1;j++)
    {
    if(i==j)
    cout<<"0";
    else if(i<j)
    {
    cout<<k++;
    }
    else
    cout<<--k;
    }
    cout<<endl;
    }
    }
    {

    ReplyDelete
  5. #include

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

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

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

    printf("0");

    for(j=r-1;j>=i;j--)
    {
    printf("%d",j);
    }

    printf("\n");
    }
    }

    ReplyDelete