Diagonal Number Pattern In C

Q. Write a C program to make a diagonal number pattern as following design:



/* c program source code for diagonal number pattern*/

int main()
  int num,r,c,sp;
  printf("Enter total no. rows : "); 
  scanf("%d", &num);
  for(r=1; r<=num; r++)
    for(sp=r; sp<num; sp++)
        printf(" ");
    printf(" %d\n",r);
  return 0;

The output of above program would be:
Output of diagonal Number Pattern In C Program
Figure: Screen shot for Diagonal Number Pattern In C Output

You might also like to read:

  1. Big list of 98+ C pyramid programs
  2. Latest user asking pyramid program list

No comments:

Post a Comment