C Program to Print the Double Pyramid Pattern


Problem Statement : Program to Print the Double Pyramid Pattern



Output :

Explain Me ?

As the above coding is very difficult to understand , so I have divided Program in 5 Steps.Easy steps are as follow ,
Step 0 :
Program has 7 lines i.e (0 to 6)


Variables : i is used to trace the Current Line
Variables : j is used for Subscript variable for Different Loops
Variables : k is used to trace the diff array , for each new value of i (new line) k is incremented

Variable : diff[7] is used for Storing the number of blanks
eg.

Here G is Missing so blank = 1;
Step 1 :

Will be Printed
Step 2 : Initialize Blank i.e for first line blank = 0 , for second line it will be 1 and so on


Will be Printed, Blanks are denoted by    
Step 3 :

Here symbol variable is initialized , Consider first Line , We are printing Letter ‘F’ after ‘G’ so initialize it .
for 3rd line
>> blank = 3 , so
>> symbol = ‘F’ – 1 = ‘E’
step 4 :

Here print remaining characters , until we print ‘A’