Java program to print the following pattern on the console17 Mar 2025 | 1 min read ![]() To accomplish this task, we need to create two loops and the 2nd loop is to be executed according to the first loop. The first loop is responsible for printing the line breaks whereas the second loop is responsible for printing the stars (*). Algorithm:
Program:Output: ![]() Next TopicJava Programs |
Java Program to print Odd and Even Numbers from an Array We can print odd and even numbers from an array in java by getting remainder of each element and checking if it is divided by 2 or not. If it is divided by 2, it is...
1 min read
In this program, we need to check whether a string is a rotation of another string or not. String 1: abcde String 2: deabc String 1 + String 1: abcdeabcde Consider the above example, suppose we need to check whether string 2 is a rotation of string 1. To...
2 min read
Program to find the frequency of each element in the array In this program, we have an array of elements to count the occurrence of its each element. One of the approaches to resolve this problem is to maintain one array to store the counts of...
3 min read
In this section, we will learn what is an emirp number and also create Java programs to check if the given number is emirp or not. The emirp number Java program frequently asked in Java coding tests to check the logic of the programmer. Emirp Number A number...
2 min read
In this program, we need to display the lower triangular matrix. Lower Triangular Matrix Lower triangular matrix is a square matrix in which all the elements above the principle diagonal will be zero. To find the lower triangular matrix, a matrix needs to be a square matrix...
4 min read
In this section, we will learn what is a strontio number and also create Java programs to check if the given number is strontio. The strontio number program frequently asked in Java coding tests and academics. Strontio Number Strontio numbers are those four digits numbers when multiplied by...
3 min read
An array of unsorted integers is given. Our task is to move all the zero elements to the end and non-zero elements to the front. Note the relative arrangement of the non-zero elements should never get disturbed. The following examples make things clearer. Example 1: Input: int arr[]...
6 min read
Java program to print the following pattern on the console In this program, we are creating a right-angled triangle of numbers in increasing order. We are creating two loops, and 2nd loop is executing according to the first loop, inside 2nd loop printing the number row-wise...
2 min read
Program to print smallest and biggest possible palindrome word in a given string In this program, we need to find the smallest and biggest palindromic word present in the given string. Wow you own kayak In above example, wow represent the smallest palindrome and kayak represent the biggest...
3 min read
Linear search is a technique that retrieves information from data structures. It is one of the simplest and most intuitive searching algorithms. It searches for a key element among multiple elements. It is not widely used because it is slower than binary search and hashing. Linear...
5 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India