Rocket pattern
2 min readNov 29, 2025
This is the pattern problem that is usualy asked by Webkul during their hiring process. This problem is written in Java programming language. You can implement same logic in your preferred language.
import java.util.Scanner;Get Aarya Raaz’s stories in your inbox
Join Medium for free to get updates from this writer.
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("\n[*** AARYA RAAZ ***]\n[** Find me: @oneAaryaa **]\n");
System.out.print("Enter a number: ");
int n = sc.nextInt();
// top section
for(int i = 0; i < n/2 + 1; i++) {
// space
for(int j = 0; j < n/2; j++) System.out.print(" ");
// top tringle21
for(int j = n/2; j < n - i; j++) System.out.print(" ");
for(int j = 0; j <2*i + 1; j++) System.out.print("*");
System.out.println();
}
// top vertical line
for(int i = 0; i < n; i++) {
// space
for(int j = 0; j < n; j++) System.out.print(" ");
// e
System.out.print("e");
System.out.println();
}
// horizontal line space and star
for(int i = 0; i < n/2; i++) System.out.print(" ");
for (int i = 0; i < n + 2; i++) System.out.print("*");
System.out.println();
// bottom vertical line
for(int i = 0; i < n; i++) {
for(int j = 0; j < n/2 + n + 2; j++) {
if(j == n/2 || j == n/2 + n + 1) System.out.print("e");
else System.out.print(" ");
}
System.out.println();
}
// foots
for(int i = 0; i < n/2 + 1; i++) {
// left foot
for(int j = 0; j < i; j++) System.out.print(" ");
for(int j = 0; j < n - i*2; j++) System.out.print("*");
// space between foots
for(int j = 0; j < i*2 + 1; j++) System.out.print(" ");
// right foot
for(int j = 0; j < n - i*2; j++) System.out.print("*");
System.out.println();
}
}
}






