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 »## Harshad Number Program in Java (Niven Numbers)

Java Program to check for Harshad Number: What is a Harshad Number? Harshad Number also called Niven Number is a number that is divisible by the sum of its digits. Example: Number 200 is a Harshad Number because sum of digits 2 and 0 and 0 is 2(2+0+0) and 200 is divisible by 2. Number 171 is a Harshad Number because ...

Read More »## java program for pattern #14

[crayon-588467bde6e81667718123/] This is an easy to implement pattern but the quality of a programmer depends on the way they implement their algorithm. How much can you reduce your coding. So here is how you can code this pattern without using if statement. Also see: Alternate c program for pattern#14 [crayon-588467bde6e8b397898226/] OUTPUT:

Read More »## Java program for Floyds Triangle

Java program for Floyds Triangle: Floyd’s Triangle is one of the most popular pattern in programming lanuguage. It is not usually famous by its name as it is very easy in implementation. The diagram below shows you the floyds triangle: [crayon-588467bde727d722042340/] OUTPUT:

Read More »## Java program for armstrong number using recursion

This is a Java program for armstrong number. But what is an armstrong number? An armstrong number is onw whose sum of the cube of digits is the number itself. Example #1: 153 ; 13 + 53 + 33 = 1+ 125 + 27 = 153 (Hence Armstrong) Example #2: 370 ; 33 + 73 + 03 = 27 + 343 + ...

Read More »## Java program to check for palindrome

Java program to check for Palindrome. What is a palindrome number or palindrome string? There are following definitions: A palindrome number or a palindrome string is one whose mirror image is same as itself. A Palindrome is exactly same as seen from beginning or ending. Concept used here: if(s.charAt(i) == s.charAt(l-i-1); MADAM : s.charAt(0) =M (first character) s.charAt(l-1-0) =M ...

Read More »## Java program to remove duplicate characters

Java program to remove duplicate characters or repeated character from a given string. Example: Thiiis is aa tessstt ssstring OUTPUT: This is a test string Thus our motive is to remove repeated characters or duplicate characters from a given string. This is done by following concept. Step #1: select the starting character: ch=str.charAt(0); (hhhello) Step #2: Add the ...

Read More »## Java program to swap two numbers without using a third variable

Here are 4 Tricks to swap two numbers without using a third variable. Here is a java program to swap two numbers without using a third variable. To do so you can use basic mathematical operations like multiplication, division and addition, subtraction. See the Further Explanation: Incoming terms: tricks to swap two numbers, swap two numbers various tricks.

Read More »## Java program to print the magic number series

This is a Java program to print the Magic number series. 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: 224; 2+2+4=10; 1+0 =1. Hence a magic number. Example#3: 874; ...

Read More »## Java program to print happy numbers for a given range

This is a Java program to print happy numbers for a given range. But what is a happy number? A number whose sum of the square of digits is ultimatly equal to 1 is a happy number. By ultimately we mean that starting with any positive number we continue the addition of square of digits till we get a single digit number ...

Read More »