Number pattern 1 2 4 3 6 9 2 4 1

#include <stdio.h>

int main()
{
    int n = 5; //limit 
    int x=1,m;
    int i,j; 


  for (i = 1; i <= n; i++) 
  { 
      m=1;
      for (j = 1; j <= x; j++) 
      { 
        printf("%d ",x*m); 
        m++;
      } 
      if(i<=n/2)
        x++;
      else
        x--;
    printf("\n"); 
   } 
  return 0;
}

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *