Java program to print the following pattern on the console8 Jan 2025 | 2 min read 0 Algorithm:
Program:Output: 0 909 89098 7890987 678909876 56789098765 4567890987654 345678909876543 23456789098765432 1234567890987654321 Next TopicJava Programs |
: The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. The formula for calculating the factorial of a number n is: n! = n * (n-1) * (n-2) * ... * 2 * 1 Factorial of...
6 min read
In this program, we need to create a binary search tree, delete a node from the tree, and display the nodes of the tree by traversing the tree using in-order traversal. In in-order traversal, for a given node, first, we traverse the left child then...
11 min read
In this program, we need to check whether the given matrix is an identity matrix. Identity Matrix A matrix is said to be an identity matrix if it is a square matrix in which elements of principle diagonal are ones, and the rest of the elements are...
4 min read
5432* 543*1 54*21 5*321 *4321 Algorithm: STEP 1: START STEP 2: DEFINE i, j. STEP 3: SET lines=5 STEP 4: SET i=1. REPEAT STEP 5 to STEP 10 UNTIL i <= lines STEP 5: SET j=lines STEP 6: REPEAT STEP 7 and 8 UNTIL j >= 1 STEP 7: IF j!=i then PRINT j ...
1 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 Java, there are many ways to swap two numbers. Generally, we use either swap() method of the Math class or use a third (temporary) variable to swap two numbers. Except these two ways, we can also swap two numbers using the bitwise operator (XOR) and...
3 min read
An array numArr[] is given, which only contains the non-negative integers, and an integer sp is also provided. The task is to partition the array into sp continuous subarrays such that the largest sum among these sp subarrays is minimum. Note that subarrays can never be...
19 min read
In this section, we will create a Java program to display odd numbers from 1 to 100. To learn the Java odd number program, you must have the basic knowledge of Java for loop and if statement. We can use different Java loops to display odd numbers: Using...
3 min read
It is very interesting problem frequently asked in interviews of top IT companies like Google, Amazon, TCS, 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 going...
6 min read
In this section, we will create a Java program to display even numbers from 1 to 100. To learn the Java even number program, you must have the basic knowledge of Java for loop and if statement. We can use different ways to display even numbers: Using Java...
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