Search C Program | nimishsoft@gmail.com

Number Pattern - 21

1 
2 6 
3 7 10 
4 8 11 13 
5 9 12 14 15

#include<stdio.h>
int main()
{
  int i,j,k;
  for(i=1;i<=5;i++)
  {
    k = i;
    for(j=1;j<=i;j++)
    {
      printf("%d ", k);
      k += 5-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


23 comments:

  1. please reply asap :
    1
    6 2
    10 7 3
    13 11 8 4
    15 14 12 9 5

    ReplyDelete
    Replies
    1. #include
      using namespace std;
      int main()
      {

      int n;
      cin>>n;
      int x=n;
      int k=1;
      for(int i=n;i>=1;i--){
      int x=k;
      for(int j=i;j<=n;j++){

      cout<<x<<" ";
      x=x-j;
      }
      cout<<endl;
      k+=i;
      }

      return 0;
      }

      Delete
  2. #include

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

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

    for(i=1;i<=r;i++)
    {
    for(j=1,a=4,k=i;j<=i;j++,k+=a,a--)
    {
    printf("%d ",k);
    }
    printf("\n");
    }
    }

    ReplyDelete
  3. 1 4 7 21 24 27
    2 5 8 20 23 26
    3 6 9 19 22 25
    10 15 18
    11 18 17
    12 14 16
    can you please help me with this?

    ReplyDelete
  4. 1 4 7 . 21 24 27
    2 5 8 . 20 23 26
    3 6 9 . 19 22 25
    . . 10 15 18 . .
    . . 11 18 17 . .
    . . 12 14 16 . .

    ReplyDelete
  5. 1
    2 9
    3 8 10
    4 7 11 14
    5 6 12 13 15
    can u pls help me with this

    ReplyDelete
  6. 1
    2 9
    3 8 10
    4 7 11 14
    5 6 12 13 15

    ReplyDelete
    Replies
    1. #include

      int main()
      {
      int i,j,k,n=5;
      for(i=0;i<n;i++)
      {
      k=i+1;
      for(j=0;j<=i;j++)
      {


      printf("%d",k);
      k+=5-(j+1);


      }
      printf("\n");
      }

      return 0;
      }

      Delete
    2. #include
      int main()
      {
      int rows;
      scanf("%d",&rows);
      for(int i = 0; i < rows; i++)
      {
      for(int j = 0; j <= i; j++)
      {
      if (j % 2 == 0)
      {
      printf("%d ",(1 + j * rows - (j - 1) * j / 2 + i - j ));
      } else
      {
      printf("%d ",(1 + j * rows - (j - 1) * j / 2 + rows - 1 - i ));
      }
      }

      printf("\n");
      }
      return 0;
      }

      Delete
    3. This comment has been removed by the author.

      Delete
  7. how i can reverse these pattern like start from 10 and end at 1 but pattern can not be changed

    ReplyDelete
  8. Can you do this program by using single for loop

    ReplyDelete
  9. how do you do thus pattern in visual basic?

    ReplyDelete
  10. 1
    2 4
    3 5 7
    6 8 10 12
    9 11 13 15 17
    how do we print this pattern

    ReplyDelete
  11. Can anyone please gime this code in Java

    ReplyDelete
  12. 1
    2 9
    3 8 10
    4 7 11 14
    5 6 12 13 15

    ReplyDelete