Java program to print the following pattern17 Mar 2025 | 2 min read ![]() Algorithm:
Program:Output: ![]() Next TopicJava Programs |
A number is prime if it is divisible by 1 and itself. In other words, a prime number is a natural number with exactly two distinct natural number divisors 1 and itself. For example, 2, 3, 5, 7, 11, etc. are the prime numbers. Note that...
5 min read
In this program, we will find out the smallest node in the given binary tree. We first define variable min that will hold root's data. Then, we traverse through left sub-tree to find the smallest node in left subtree. Compare it with min and store...
5 min read
In this program, we need to create a singly linked list and display the list in reverse order. Original List Reversed List One of the approaches to solving this problem is to reach the end the of the list and display the nodes from tail to head recursively. Algorithm Create...
5 min read
Java String to float We can convert String to float in java using Float.parseFloat() method. Scenario It is generally used if we have to perform mathematical operations on the string that contains float number. Whenever we get data from textfield or textarea, entered data is received as a string....
1 min read
Java Program Number to Word In this section, we will create a Java program that converts the given number into words. For example, if the given number is 54,297 then the output should be Fifty-Four Thousand Two Hundred Ninety-Seven. Let's create a Java program for the same. NumberToWordExample1.java class...
9 min read
How do you find duplicate characters in a string? Following program demonstrate it. File: DuplicateCharFinder .java import java.util.HashMap; import java.util.Map; import java.util.Set; public class DuplicateCharFinder { public void findIt(String str) { Map<Character, Integer> baseMap = new HashMap<Character, Integer>(); char[] charArray = str.toCharArray(); for (Character ch : charArray) { if (baseMap.containsKey(ch)) { baseMap.put(ch, baseMap.get(ch) + 1); } else...
1 min read
In this section, we will learn what is a fascinating number and also create Java programs to check if the given number is fascinating or not. The fascinating number program is frequently asked in Java coding tests. Fascinating Numbers Multiplying a number by two and three separately, the...
3 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
Bubble Sort is one of the simplest sorting algorithms, primarily used for educational purposes due to its ease of implementation and understanding. Despite its simplicity, it's not the most efficient sorting algorithm for large datasets. However, comprehending Bubble Sort provides a foundational understanding of sorting...
6 min read
The Evil number is another special positive whole number in Java that has an even number of 1's in its binary equivalent. Unlike Prime and Armstrong numbers, Evil number is not so popular and asked by the interviewers. The numbers which are not evil are called odious...
3 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