Search C Program

Loading...

Number Pattern - 27

1
121
12321
1234321

#include<stdio.h>

int main()
{
  int i,j;
  for(i=1;i<=4;i++)
  {
    for(j=1;j<=i;j++)
      printf("%d",j);
    for(j=i-1;j>=1;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


4 comments:

  1. class Pattern
    {
    public static void main(String arr[])
    {

    for(int i=1;i<=4;i++)
    {
    int k=1;
    for(int j=1;j<=i;j++)

    System.out.print(j);

    for(int j=i-1;j>=1;j--)

    System.out.print(j);
    System.out.println();

    }

    }
    }

    ReplyDelete
  2. class pattern
    {
    public static void main(String args[])
    { int n=1;
    for(int i=1; i<=4; i++)
    { int m=0;
    for(int j=1; j<=n; j++)
    {
    if(j<=(n+1)/2)
    { m++;
    System.out.print(+m);

    }
    else
    { m--;;
    System.out.print(+m);
    }
    }
    System.out.println("");
    n=n+2;
    }
    }
    }

    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=1;i<=5;i++){

    for(j=1;j<=k;j++){
    if(j>=i){

    System.out.print(l);
    l--;
    }
    else{

    System.out.print(l);
    l++;
    }

    }
    k+=2;
    System.out.println("");
    l=1;
    }
    }

    }

    ReplyDelete
  4. #include

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

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

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

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

    printf("\n");
    }
    }

    ReplyDelete