Wednesday , November 22 2017
Home / JAVA

JAVA

Java Program to check for a Magic Number

This is a Java program for Magic number. However before starting let me tell you what is a magic number. A Magic number is a number whose sum of digits eventually leads to 1. Example#1:  19 ;  1+9 =10 ; 1+0 = 1.  Hence a magic number. Example#2:  226; 2+2+6=10; 1+0 =1.  Hence a magic number. Example#3:  874; 8+7+4=19; 1+9=10; 1+0=1. ...

Read More »

program for display lower triangular matrix in java

What is Lower Triangular Matrix? Lower Triangular Matrix is if all the elements above the main diagonal of a square matrix are zero then the matrix is called ‘Lower Triangular Matrix’. Example:   The matrix contains all the elements above main diagonal is zero, so this matrix is lower triangular matrix.   import java.util.*; public class LowerTriangularMatrix { public static void ...

Read More »

Program to check Pronic number

Pronic number in Java: A Pronic number is a number which is the product of two consecutive integers, that is n*(n+1), Pronic number also express as (n² + n). A Pronic number is also known as oblong number, rectangular number or heteromecic number. There are 99 pronic numbers below 10,000.   Mathematical Properties: Pronic numbers are even number. Therefore, all ...

Read More »

Java program to implement polymorphism

Java program to implement polymorphism: Polymorphism is a technique in java with which you can create multiple functions with same name but each having different arguments. It means that we have a program in which we have several functions with same name but have different arguments which are easy to use as if we put different names to the functions ...

Read More »

Program to check Upper Triangular matrix

What is Upper Triangular Matrix?  An upper triangular matrix is a square matrix in which all the elements below the diagonal are zero. We consider a Matrix U with ‘i’ rows and ‘j’ columns, then mathematically we represent the upper triangular matrix as In another word strictly upper triangular matrix is an upper triangular matrix having 0’s along the diagonal ...

Read More »

Java Program to find Mobius Function of number

Mobius Function Java Program:  The MOBIUS function µ(n) for a natural number N is defined as follows: µ(n) = 1 if n is a square free positive integer with an even number of prime factors. µ(n) = 0 if n has a squared prime factor. µ(n) = -1 if n is a square free positive integer with an odd number of ...

Read More »

Program for Matrix Multiplication in JAVA

Matrix Multiplication:– Here is given a Java Program for Matrix Multiplication also call matrix product. In other words, Let the two matrix to be multiplied be A and B. Let A is an n × m order matrix and B is an m × p order matrix, their matrix product A*B is an n × p order matrix, in which the m ...

Read More »

Program for Fascinating Number in JAVA

Fascinating Number :- The number of 3 digit or more, when we multiplied that number by 2 and 3, and product of both is concatenated with the original number, after concatenated the number contain all the digits from 1 to 9 exactly once, regardless of the number of zeros. Example: Consider a number 327 327*1=327 327*2=654 327*3=981 Concatenating all result: ...

Read More »

JAVA program to check Anagram of a Words

Program in Java to Check if the word is a anagram of a given word: An anagram is a type of word play, the result of rearranging the letters of a word to produce a new word or we can say the possible string we make by rearranging the letter of word. Example: Anagram of the word ‘ABC’ are : ABC, ...

Read More »

JAVA program to calculate digit sum of an integer

The digit sum of a given integer number is the sum of all its individual digits. Java Source code to calculate sum of digits of a number is given with example and detailed explanation. The sum of the digits of a number are calculated or used in many further programs. Digit Sum Example:- Iteration 1 : 1894%10 = 4 1894/10= 189 value ...

Read More »