Explore
ProGrad Programs
About Us

Edit
Reply




Edit

Diamond pattern printing using stars | FACE Prep

Published on 11 Mar 2020

Program to print diamond star patterns is discussed here. Given a number n, write a program to print a diamond shape with 2*n rows.


Solid Diamond pattern printing using stars


Input: 5


Output:

         *
       *  * 
     *  *  *  
   *  *  *  *  
  *  *  *  *  *
    *  *  *  *
     *  *  *  
      *  * 
        *


Program for solid diamond pattern using stars


C
C++
Java
Python 3

Output
Enter the number of rows : 5

    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *


Hollow diamond pattern printing using stars


Input: 5


Output:

     *
   *  * 
  *    *
 *      *  
*        *  
*        *
 *      *
  *    *  
   *  * 
     *


Program for hollow diamond pattern using stars


C
C++
Java
Python 3

Output
Enter the number of rows : 5
    *
   *  *
  *    *
 *      *
*        *
*        *
 *      *
  *    *
   *  *
    *


Solid Half Diamond pattern printing using stars


Input:5


Output:

*
* *
* * *
* * * *
* * * * * 
* * * *
* * * 
* *
*


Program for solid half diamond pattern printing using stars


C
C++
Java

Output
Enter the number of rows : 5

*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*


Half Diamond pattern using stars and numbers in a palindromic pattern


Input: 3 (Number of rows)


Output:

*
* 1 *
* 1 2 1 *
* 1 2 3 2 1 *
* 1 2 1 *
* 1 *
*


Program for palindromic pattern printing in a half diamond


C
C++
Java
Python 3

Output
Enter the number of rows : 5

*
* 1 *
* 1 2 1 *
* 1 2 3 2 1 *
* 1 2 1 *
* 1 *
*


Recommended Programs






If you have any feedback about this article and want to improve this, please write to enquiry@faceprep.in