Write a Java Program to print mirrored rhombus star patterns using for loop. This mirrored rhombus pattern example uses nested for loops to iterate the rhombus rows.
package ShapePrograms;
import java.util.Scanner;
public class MirroredRhombus1 {
private static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
System.out.print("Enter Mirrored Rhombus Pattern Rows = ");
int rows = sc.nextInt();
System.out.println("Printing Mirrored Rhombus Star Pattern");
for (int i = 1 ; i <= rows; i++ )
{
for (int j = 1 ; j < i; j++ )
{
System.out.print(" ");
}
for (int k = 1 ; k <= rows; k++ )
{
System.out.print("*");
}
System.out.println();
}
}
}

In this mirrored rhombus star pattern program, we replaced the for loops with while loops.
package ShapePrograms;
import java.util.Scanner;
public class MirroredRhombus2 {
private static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
System.out.print("Enter Mirrored Rhombus Pattern Rows = ");
int rows = sc.nextInt();
System.out.println("Printing Mirrored Rhombus Star Pattern");
int j, k, i = 1 ;
while( i <= rows )
{
j = 1 ;
while (j < i )
{
System.out.print(" ");
j++;
}
k = 1 ;
while( k <= rows )
{
System.out.print("*");
k++ ;
}
System.out.println();
i++;
}
}
}
Enter Mirrored Rhombus Pattern Rows = 10
Printing Mirrored Rhombus Star Pattern
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
Java Program to Print Mirrored Rhombus Star Pattern using do while loop
package ShapePrograms;
import java.util.Scanner;
public class MirroredRhombus3 {
private static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
System.out.print("Enter Mirrored Rhombus Pattern Rows = ");
int rows = sc.nextInt();
System.out.println("Printing Mirrored Rhombus Star Pattern");
int j, k, i = 1 ;
do
{
j = 1 ;
do
{
System.out.print(" ");
} while (j++ < i );
k = 1 ;
do
{
System.out.print("*");
} while( ++k <= rows );
System.out.println();
} while( ++i <= rows ) ;
}
}
Enter Mirrored Rhombus Pattern Rows = 15
Printing Mirrored Rhombus Star Pattern
***************
***************
***************
***************
***************
***************
***************
***************
***************
***************
***************
***************
***************
***************
***************
In this example, the MirroredRhombusPat function prints the mirrored rhombus pattern of a given symbol.
package ShapePrograms;
import java.util.Scanner;
public class MirroredRhombus4 {
private static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
System.out.print("Enter Mirrored Rhombus Pattern Rows = ");
int rows = sc.nextInt();
System.out.print("Enter Character for Mirrored Rhombus Pattern = ");
char ch = sc.next().charAt(0);
MirroredRhombusPat(rows, ch);
}
public static void MirroredRhombusPat(int rows, char ch) {
for (int i = 1 ; i <= rows; i++ )
{
for (int j = 1 ; j < i; j++ )
{
System.out.print(" ");
}
for (int k = 1 ; k <= rows; k++ )
{
System.out.print(ch);
}
System.out.println();
}
}
}
Enter Mirrored Rhombus Pattern Rows = 12
Enter Character for Mirrored Rhombus Pattern = $
$$$$$$$$$$$$
$$$$$$$$$$$$
$$$$$$$$$$$$
$$$$$$$$$$$$
$$$$$$$$$$$$
$$$$$$$$$$$$
$$$$$$$$$$$$
$$$$$$$$$$$$
$$$$$$$$$$$$
$$$$$$$$$$$$
$$$$$$$$$$$$
$$$$$$$$$$$$