Category: Java Programs

Java Program to print Reverse Pyramid Star Pattern
Introduction The program here illustrates Java Program to print Reverse Pyramid Star Pattern. Approach The first step is to take input from the user or otherwise the number of rows of the reverse pyramid pattern you want to print out. This can be done using Scanner Class or Buffered Reader class object. Based on the…

Java Program to Print Pyramid Star Pattern
Introduction The article here will illustrate Java Program to Print Pyramid Star Pattern containing nested loops. Sample Code 1: Simple Pyramid Pattern import java.io.* //Java Code to demonstrate Pyramid star patterns public class Demo { //Function to demonstrate printing pattern public static void PyramidStar (int n) { int a, b; //outer loop to handle the…

Java Program to Print Left Triangle Star Pattern
Introduction In this article, we will explore Java Program to Print Left Triangle Star Pattern. The program in this article prints out the left triangular star pattern as follows: Example: Input : n = 5 Output: * * * * * * * * * * * * * * * Here the input n…

Java Program to Print Right Triangle Star Pattern
Introduction In this article, we will explore Java Program to Print Right Triangle Star Pattern. The program in this article prints out the right triangular star pattern as follows: Example: Input : n = 5 Output: * * * * * * * * * * * * * * * Here the input n…

Java Program to Find Out the Area and Perimeter of Rectangle Using Class Concept
Introduction The Perimeter of any particular shape can be considered an outline of a particular length. To be more precise, it is the length of the outline of any particular shape. Following the definition, it goes logically that the perimeter of a rectangle or square is a summation of the lengths of the four sides.…

Java Program to find Compound Interest
Introduction This article illustrates that a Java program can calculate compound interest on a sum of money. The formula to calculate compound interest on a sum of money is as follows: Compound Interest = P (1 + R/100) ^ r where, P is the principal Amount R is the rate of interest T is the…

Java Program to Calculate Simple Interest
Introduction A simple formula gives the Simple Interest: Simple Interest = (Principal * Time * Rate of Interest) / 100 Where, The principal Amount is the main sum of money you put in a bank. Time is the duration during which you want to calculate the interest generated and the Rate of the interest determines…

Java Program to Check Whether the Character is Vowel or Consonant
Introduction This Java program checks if the character in question is a vowel or a consonant. The vowels in the English alphabet are a, e, i, o, and u. The consonants in the English alphabet are b, c, d, f, ….., that is, all letters that are not vowels. Examples: Input: char = r Output:…

Java Program to Check if a Number is a Neon Number or not
What is a Neon Number? If you are given a number and the summation of the square of the individual digits of the number equal to the number itself, then the number is called a neon number. Example: For the number 9: 9*9 = 81 and 8 + 1 = 9 Illustration: Case 1: Input:…

Java Program to Check for Armstrong numbers between two integers
Introduction The program below demonstrates how to check for Armstrong numbers between two integers in Java. What are Armstrong Numbers? A positive number with digits a, b, c, d, … n is called an Armstrong number of the order of n if the number meets the condition laid out below: abcd …… n = a^n…