Java Program to Calculate the Power of a Number
Example 1: Calculate power of a number using a while loop public class Power { public static void main(String[] args) { int base = 3, exponent = 4; long result…
Example 1: Calculate power of a number using a while loop public class Power { public static void main(String[] args) { int base = 3, exponent = 4; long result…
In this program we will learn to reverse any number wsing for loop and while loop. Ex: 12345 -> 54321 Method 1: Reverse a Number using a while loop in…
In this program we will learn using while loop and for loop and we will find the number of digits in an Integer. Method 1: Count Number of Digits in…
In this program we will learn how to print English Alphabets in Upper case and Lower case using for loop. Method 1: Display Uppercased A to Z using for loop…
In this program we will look at two methods of finding LCM of two numbers 1. by using GDC and 2. without using GDC Also, you should know what is…
First of all, you should understand what is GCD? GCD or also called HCF means Highest Common Factor or Greatest common divisor. GCD of two integers is the largest number…
First of all you need to know what is Fibonacci series? It is a series where next term is the sum of previous two terms. The first number of the…
Example 1: Generate Multiplication Table using for loop public class MultiplicationTable { public static void main(String[] args) { int num = 5; for(int i = 1; i <= 10; ++i)…
Example 1: Find Factorial of a number using for loop public class Factorial { public static void main(String[] args) { int num = 10; long factorial = 1; for(int i…
Example 1: Sum of Natural Numbers using for loop public class SumNatural { public static void main(String[] args) { int num = 100, sum = 0; for(int i = 1;…