Java program to print the following pattern8 Jan 2025 | 1 min read 1 Algorithm:
Program:Output: 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 6 12 18 24 30 36 7 14 21 28 35 42 49 8 16 24 32 40 48 56 64 9 18 27 36 45 54 63 72 81 10 20 30 40 50 60 70 80 90 100 Next TopicJava Programs |
Java program to print the following pattern on the console 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 Algorithm: STEP 1: START STEP 2: DEFINE i, j. STEP 3: SET n=5. STEP 4: SET i=n. REPEAT STEP 5 to STEP 7 UNTIL i>0. STEP 5: SET j=1. REPEAT STEP...
2 min read
In this program, we need to count the number of characters present in the string: The best of both worlds To count the number of characters present in the string, we will iterate through the string and count the characters. In above example, total numbers of characters...
2 min read
It is a problem frequently asked in interviews of top IT companies like Google, Amazon, TCS, HCL, IBM, and Accenture, etc. By solving the problem, one wants to check the logical ability, critical thinking, and problem-solving skill of the interviewee. So, in this section, we are...
10 min read
Java Convert boolean to String We can convert boolean to String in java using String.valueOf(boolean) method. Alternatively, we can use Boolean.toString(boolean) method which also converts boolean into String. 1) String.valueOf() The String.valueOf() method converts boolean to String. The valueOf() is the static method of String class. The signature of...
1 min read
In this program, we will create a circular linked list and remove duplicate nodes from the list. We will compare a node with rest of the list and check for the duplicate. If the duplicate is found, delete the duplicate node from the list. 1->2->2->4->3 In the...
2 min read
In this program, we need to check whether a given string is palindrome or not. A string is said to be palindrome if it is the same from both the ends. For e.g. above string is a palindrome because if we try to read it from...
2 min read
In this section, we will learn how to reverse a number in Java using while loop, for loop and recursion. To reverse a number, follow the steps given below: First, we find the remainder of the given number by using the modulo (%) operator. Multiply the variable reverse...
5 min read
In this program, we need to sort the given array in descending order such that elements will be arranged from largest to smallest. This can be achieved through two loops. The outer loop will select an element, and inner loop allows us to compare selected...
3 min read
In this section, we will learn what is tech number and how can we find tech numbers through a Java program. Tech Number A number is called a tech number if the given number has an even number of digits and the number can be divided exactly into...
3 min read
A prime number is a number that is greater than 1 and divided by 1 or itself. In other words, prime numbers cannot be divided by other than itself or 1. For example, 2, 3, 5, 7, 11, 13, 17... are the prime numbers. Note: 0 and...
6 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