New Want to Write for Computaholics ? if Yes Contact us at "contact@computaholics.in"

Write a c program to print given number pattern

Write a c program to print given number pattern
1                   1
12               21
123           321
1234       4321
12345   54321
123456654321

#include<stdio.h>

int main()
{
  int i,m;
  for(i=1;i<=6;i++)
  {
    for(m=1;m<=6;m++)
    {
      if(m<=i)
        printf("%d",m);
      else
        printf(" ");
    }
    for(m=6;m>=1;m--)
    {
      if(m<=i)
        printf("%d",m);
      else
        printf(" ");
    }
    printf("\n");
  }
}
Copyright © C Program | Java | OpenGL Programming | Hadoop at Computaholics