7.19.2016

Reverse Floyd Number Pattern C Program

Q. Write a reverse Floyd number pattern C program as:

       5
       4 3
       2 1 0
 or

      9
      8 7
      6 5 4 
      3 2 1 0

Ans.

/* reverse floyd number pattern c program source code */

#include<stdio.h>
int main()
{
 int num,n,r,c,p,i=0;
 printf("Enter Total No. of Row : ");
 scanf("%d", &num);
 printf("Enter loop start no. : ");
 scanf("%d", &n);
 for(r=1; r<=num; r++, n=n-i)
 {
     for(c=1, p=n; c<=r; c++,p--)
         printf(" %d ",p);
     i++;
     printf("\n");
 }
 getch();
 return 0;
}


/*****************************************************
The output of above reverse floyd number pattern c program would be:
******************************************************/
Output of Reverse Floyd Number Pattern C Program
Figure: Screen shot for Reverse Floyd Number Pattern C Program

You might also like to read:

1. Floyd Number Triangle C program
    
     1
     2  3
     4  5  6
     7  8  9 10

2. Floyd Character Triangle C program
  
     A
     B  C
     D  E  F
     G  H  I  J 

3. Half Diamond Floyd number pattern C program

    1
    2  3
    4  5  6
    7  8  9  10
    4  5  6
    2  3
    1

4. Big list of 98+ C pyramid programs list
5. Latest user asking pyramid program list

No comments:

Post a Comment