
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7442 Articles for Java

2K+ Views
For a given integer number, write a Java program to print its multiplication table. In mathematics, a multiplication table shows the product of two numbers. Printing Multiplication Table using for Loop In Java, a for loop is used when a specific block of code needs to be executed multiple times. Here, we will run this loop 10 times and increment the loop variable by one with each iteration. During this iteration, multiply the given integer value with the current value of the loop variable to get the multiplication table. Example Following is a Java program which prints the multiplication ... Read More

2K+ Views
For a given integer number, write a Java program to print its multiplication table. In mathematics, a multiplication table shows the product of two numbers. Printing Multiplication Table using for Loop In Java, a for loop is used when a specific block of code needs to be executed multiple times. Here, we will run this loop 10 times and increment the loop variable by one with each iteration. During this iteration, multiply the given integer value with the current value of the loop variable to get the multiplication table. Example Following is a Java program which prints the multiplication ... Read More

8K+ Views
In this article, we will learn to find the LCM of two numbers using Java. L.C.M. or Least Common Multiple of two values is the smallest positive value which is the multiple of both values. For example, multiples of 3 and 4 are: 3 → 3, 6, 9, 12, 15 ... 4 → 4, 8, 12, 16, 20 ... The smallest multiple of both is 12, hence the LCM of 3 and 4 is 12.We will learn through two different methods to solve this: an incremental method and a formula-based approach using the Greatest Common Divisor (GCD). Problem Statement Write ... Read More

8K+ Views
In this article, we will learn to find the LCM of two numbers using Java. L.C.M. or Least Common Multiple of two values is the smallest positive value which is the multiple of both values. For example, multiples of 3 and 4 are: 3 → 3, 6, 9, 12, 15 ... 4 → 4, 8, 12, 16, 20 ... The smallest multiple of both is 12, hence the LCM of 3 and 4 is 12.We will learn through two different methods to solve this: an incremental method and a formula-based approach using the Greatest Common Divisor (GCD). Problem Statement Write ... Read More

36K+ Views
An H.C.F or Highest Common Factor, is the largest common factor of two or more values.For example factors of 12 and 16 are −12 → 1, 2, 3, 4, 6, 12 16 → 1, 2, 4, 8, 16The common factors are 1, 2, 4 and the highest common factor is 4.AlgorithmDefine two variables - A, BSet loop from 1 to max of A, BCheck if both are completely divided by same loop number, if yes, store itDisplay the stored number is HCFExample: Using Java for loop import java.util.Scanner; public class GCDOfTwoNumbers { public static void main(String args[]){ ... Read More

36K+ Views
An H.C.F or Highest Common Factor, is the largest common factor of two or more values.For example factors of 12 and 16 are −12 → 1, 2, 3, 4, 6, 12 16 → 1, 2, 4, 8, 16The common factors are 1, 2, 4 and the highest common factor is 4.AlgorithmDefine two variables - A, BSet loop from 1 to max of A, BCheck if both are completely divided by same loop number, if yes, store itDisplay the stored number is HCFExample: Using Java for loop import java.util.Scanner; public class GCDOfTwoNumbers { public static void main(String args[]){ ... Read More

22K+ Views
Suppose an integer number is given as an input, our task is to write a Java program to count the number of digits in that integer. For this problem, create a counter variable and initialize it with 0. Divide the given integer value with 10 till the integer becomes 0 and increment the counter variable for each turn. Using while Loop A while loop in Java is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. For the given problem, we use this loop to check whether the specified integer value is ... Read More

22K+ Views
Suppose an integer number is given as an input, our task is to write a Java program to count the number of digits in that integer. For this problem, create a counter variable and initialize it with 0. Divide the given integer value with 10 till the integer becomes 0 and increment the counter variable for each turn. Using while Loop A while loop in Java is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. For the given problem, we use this loop to check whether the specified integer value is ... Read More