Posts

Swapping Diagonal elements of a Matrix

Image
Java Program To Swap Diagonal elements of a Matrix A matrix of order N X N  is given. S wap  the  elements  of major and minor   diagonals .  Major  Diagonal Elements  of a  Matrix  are the ones that occur from Top Left of  Matrix  Down To Bottom Right Corner . The Major  Diagonal  is also known as Main  Diagonal   or Primary  Diagonal . Minor Diagonal  Elements of a  Matrix   : The  Minor Diagonal  Elements are the ones that occur from Top Right of  Matrix  Down To Bottom Left Corner . Also known as Secondary  Diagonal . Logic and Program :-

PalPrime Number in JAVA

Image
Palindromic Prime Number in JAVA If a number is simultaneously palindromic and prime then it is said to be a  PalPrime  Number. Example: Number 313, 353 etc are PalPrime  number. Algorithm and Program below :-

Magic Number in JAVA

Magic Number in JAVA A Number is said to be a Magic Number if the sum of its digits are calculated till a single digit is obtained by recursively adding the sum of its digits. If the single digit comes to be 1  then the number is a Magic Number . Example- 199 is a magic number as 1+9+9=19 but 19 is not a sigle digit number so 1+9=10 and then 1+0=1 which is a single digit number and also 1.Hence it is a magic number. PROGRAM below :-

Composite Number in JAVA

Image
Composite Number in JAVA A  Composite Number   is a positive integer that has at least one positive divisor other than one or the  number  itself. Example : 4,6,8 etc are composite number. Algorithm and Program below :-

Neon Number in JAVA

Neon Number in JAVA A Neon Number is a number whose sum of digits of square of the number is equal to the number. Example : Input number is  9 , its square is  9 * 9  =  81  and sum of the digits of square is  9 . i.e.  9  is a neon number Algorithm and Program below :-

SPY Number in JAVA

SPY Number in JAVA A Number is said to be a  SPY  Number if the sum and product of all digits are equal. Example: Number  123  is a Spy number, sum of its digits is  6 Algorithm and Program below :-

Perfect Number in JAVA

Image
Perfect Number in JAVA A  Perfect Number  is a positive integer that is equal to the sum of factors i.e. the sum of its positive factors excluding the  number  itself. Example - Factors of 6 = 1+2+3 = 6 . 6 is a Perfect Number Algorithm and Program below :-