Blog

python tutorials and learn python

Created with Sketch.

Java Program to Display Armstrong Number Between Two Intervals

Java Program to Display Armstrong Number Between Two Intervals In this program, you’ll learn to display all armstrong numbers between two given intervals, low and high, in Java.   A positive integer is called an Armstrong number of order n if abcd… = an + bn + cn + dn + … In case of…
Read more

Java Program to Check Armstrong Number

Java Program to Check Armstrong Number In this program, you’ll learn to check whether a given number is Armstrong number or not. You’ll learn to do this by using a for loop and a while loop in Java.   A positive integer is called an Armstrong number of order n if abcd… = an +…
Read more

Java Program to Display Prime Numbers Between Two Intervals

Java Program to Display Prime Numbers Between Two Intervals In this blog post, we will discuss and implement a Java program that displays prime numbers within a specified range of intervals. We’ll provide a detailed explanation of the algorithm used, present the complete Java code, and showcase the program’s output. Problem Statement: The objective is…
Read more

Java Program to Check Whether a Number is Prime or Not

Java Program to Check Whether a Number is Prime or Not In this article, you’ll learn to check whether a number is prime or not. This is done using a for loop and while loop in Java. A prime number is a number which is divisible by only two numbers: 1 and itself. So, if…
Read more

Java Program to Check Whether a Number is Palindrome or Not

Java Program to Check Whether a Number is Palindrome or Not In this program, you’ll learn to check whether a number is a palindrome or not in Java. This is done by using for and while loop.   Example 1: Program to Check Palindrome using while loop public class Palindrome { public static void main(String[]…
Read more

Java Program to Calculate the Power of a Number

Java Program to Calculate the Power of a Number In this program, you’ll learn to calculate the power of a number with and without using pow() function.   Example 1: Calculate power of a number using a while loop public class Power { public static void main(String[] args) { int base = 3, exponent =…
Read more

Java Program to Reverse a Number

Java Program to Reverse a Number In this program, you’ll learn to reverse a number using a while loop and a for loop in Java.   Example: Reverse a Number using a while loop in Java public class ReverseNumber { public static void main(String[] args) { int num = 1234, reversed = 0; while(num !=…
Read more

Java Program to Count Number of Digits in an Integer

Java Program to Count Number of Digits in an Integer In this program, you’ll learn to count the number of digits using a while loop and for loop in Java.   Example 1: Count Number of Digits in an Integer using while loop public class NumberDigits { public static void main(String[] args) { int count…
Read more

Java Program to Display Characters from A to Z using a loop

Java Program to Display Characters from A to Z using a loop In this program, you’ll learn to print English alphabets using for loop in Java. You’ll also learn to print only uppercase and lowercase alphabets. In this program, we use a for loop to iterate through the characters from ‘A’ to ‘Z’, and print…
Read more

Java Program to Find LCM of two Numbers

Java Program to Find LCM of two Numbers In this program, you’ll learn to find the lcm of two numbers by using GCD, and by not using GCD. This is done using for and while loops in Java. The LCM of two integers is the smallest positive integer that is perfectly divisible by both the…
Read more