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
*000*000*
0*00*00*0
00*0*0*00
000***000

#include<stdio.h>

int main()
{
  int j,k;
  for(j=1;j<=4;j++)
  {
    for(k=1;k<=9;k++)
    {
      if(k==j || k==5 || k==9 || 10-k==j)
        printf("*");
      else
        printf("0");
    }
    printf("\n");
  }
}
Copyright © C Program | Java | OpenGL Programming | Hadoop at Computaholics