About 689,000 results
Open links in new tab
  1. java - Using nested while loop to print pyramid of stars - Stack Overflow

    Nov 30, 2016 · I'm trying to print a pyramid of stars using nested while loops. I know I am able to achieve this using for loops but I want to do it with while loop instead. This is my code so far: public static void main(String[]args) int rows = 5, i = 1, j = 1; while(i <= rows) while(j <= i) System.out.print("*"); j++; System.out.print("\n"); i++;

  2. Java Pattern Programs – Learn How to Print Pattern in Java

    Apr 8, 2025 · Prerequisite: Remember that to learn pattern programs, you must know Java Loops (for, while, do-while) and basic syntax. Here, you will find the top 25 Java pattern programs with their proper code and explanation. 1. Square Hollow Pattern. 2. Number Triangle Pattern. 3. Number-Increasing Pyramid Pattern. 4. Number-Increasing Reverse Pyramid Pattern

  3. 15 Java Star Pattern Programs

    These 15 Java star pattern programs cover a wide variety of important patterns such as triangles, pyramids, hollow shapes, and symmetric designs. Learning to create these patterns helps you to master nested loops and conditional statements and improves problem-solving skills in Java.

  4. Java Program to Print Diamond Shape Star Pattern

    Sep 12, 2022 · We will try out different types of loops to print the same pattern. Example 1: Using do-while Loop. ************* Example 2: Using while Loop. ************* Example 3: Using for Loop. ***********

  5. Programs for printing pyramid patterns in Java - GeeksforGeeks

    May 3, 2023 · This article is aimed at giving a Java implementation for pattern printing. Simple pyramid pattern. Time Complexity: O (N^2), The outer while loop iterates N times, while the inner while loop iterates N-1 times. Hence, the total time complexity of the program will be O (N2). Space Complexity: O (1),No extra space is required.

  6. Java Pyramid Star Pattern Program | Patterns

    Apr 21, 2025 · Java program to print Pyramid star pattern program. We have written the below print/draw Pyramid asterisk/star pattern program in four different ways with sample example and output, check it out.

  7. Display integrated pyramid star pattern in Java using while loop

    Aug 16, 2024 · In this tutorial, we will discuss a concept of Display integrated pyramid star pattern in Java using while loop. In Java language, we can use for loop , while loop and do-while loop to display different number (binary, decimal), alphabets or star pattern programs.

  8. Java Program to Print Alphabet D Pattern - Tutorial Gateway

    This Java pattern program will show the steps to print the stars in an Alphabet D shape or pattern using for loop, while loop, and functions.

  9. Java code to display patterns using do while loop

    Dec 10, 2018 · In this topic, we demonstrate how to display print some number and star patterns using the nested do-while loop in Java language.

  10. Creating Star Patterns in Java with Nested Loops - Medium

    Nov 1, 2023 · Generating patterned shapes is a common and enjoyable programming task. Here, we’ll explore a simple Java code snippet for printing a star triangle pattern: This works by using two nested for...

Refresh