recent

Write a c program to print given number pattern

Write a c program to print given number pattern
0
7 0 7
6 7 0 6 7
5 6 7 0 7 6 5
4 5 6 7 0 7 6 5 4 3
3 4 5 6 70 7 6 5  4 3
2 3 4 5 6 7 0 7 6 5 4 3 2
1 2 3 4 5 6 7 0 7 6 5 4 3 2 1


#include<stdio.h>

int main()
{
  int k,j;
  printf("0 \n");
  for(k=7;k>=1;k--)
  {
    for(j=k;j<=7;j++)
      printf("%d ",j);
    printf("0 ");
    for(j=7;j>=k;j--)
      printf("%d ",j);
    printf("\n");
  }
}
Powered by Blogger.