Category: Java Examples

python tutorials and learn python

Created with Sketch.

Java Program to Display Factors of a Number

Java Program to Display Factors of a Number In this program, you’ll learn to display all factors of a given number using for loop in Java. Example: Factors of a Positive Integer public class Factors { public static void main(String[] args) { int number = 60; System.out.print(“Factors of ” + number + ” are: “);…
Read more

Java Program to Display Armstrong Numbers Between Intervals Using Function

Java Program to Display Armstrong Numbers Between Intervals Using Function Introduction In number theory, an Armstrong number (also known as a narcissistic, pluperfect, or pluperfect digital invariant) is a number that is the sum of its own digits each raised to the power of the number of digits. In this blog post, we will explore…
Read more

Java Program to Display Prime Numbers Between Intervals Using Function

Java Program to Display Prime Numbers Between Intervals Using Function In this comprehensive blog post, we will delve into a Java program designed to identify and display prime numbers within a specified range of intervals. The program emphasizes the use of functions, promoting modularity and readability. Additionally, we will explore the underlying logic and provide…
Read more

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