Page Contents
Interview Content
- C Programming Coding Questions
- C Pattern Programming Questions
- C Programming Interview Questions
- Java Programming Coding Questions
- Java Pattern Programming Questions
- Java Programming Interview Questions
- Python Programming Coding Questions
- Python Pattern Programming Questions
- Python Programming Interview Questions
- SQL Interview Questions
Most Asked Rhombus Pattern Program In Java
And below Java concepts are used to print that patterns
- For Loop
- While Loop
- if..else
1). Program to print right Inclined Solid Rhombus using star(*) in Java
import java.util.*;
class Main{
public static void main(String ...a){
int i,j,k;
Scanner sc= new Scanner(System.in);
System.out.print("Enter the number of rows for Rhombus: ");
int n= sc.nextInt();
for(i=0;i<n;i++){
for(k=1;k<n-i;k++){
System.out.print(" ");
}
for(j=0;j<=n;j++){
System.out.print("*");
}
System.out.println("");
}
}
}
Output
2). Program to print left inclined Solid Rhombus using star(*) in Java
import java.util.*;
class Main{
public static void main(String ...a){
int i,j,k;
Scanner sc= new Scanner(System.in);
System.out.print("Enter the number of rows for Rhombus: ");
int n= sc.nextInt();
for(i=n;i>=1;i--){
for(j=1;j<=n-i;j++){
System.out.print(" ");
}
for(k=1;k<=n;k++){
System.out.print("*");
}
System.out.println("");
}
}
}
Output
Latest Uploads on Website
- AVL Tree with explanation
- Radix sort algorithm explanation with example
- Quick Sort Algorithm with explanation
- Bubble sorting algorithm with Bubble sort program in C
- Insertion sort algorithm and program in C
- Selection Sort Algorithm and Program in C
- Linear probing technique explanation with example
- Collision in Hashing and Collision resolution technique
- Hashing in data structure with its types
- Binary search tree operations with Program
- Binary search tree in data structure
- Binary search algorithm in data structure with explanation
- linear search in data structure with Algo and Program