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

c program to print given number pattern

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

#include<stdio.h>
int main()
{
  int i,m;
  for(i=6;i>=1;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