Armstrong Number in Java

Armstrong Number in Java: Armstrong number is a number that is equal to the sum of cubes of its digits for example o, 1, 153, 370, 371, 407 etc.   Why 153 is an Armstrong number. 153 = (1*1*1)+(5*5*5)+(3*3*3) where:   (1*1*1)=1 (5*5*5)=125 (3*3*3)=27 So:   1+125+27=153   Why 371 is an Armstrong number. 371 = (3*3*3)+(7*7*7)+(1*1*1) where:   (3*3*3)=27 (7*7*7)=343 (1*1*1)=1 […] Continue reading →

Java Star (*) Pyramid Examples

Java Star (*) Pyramid Examples   This Java Pyramid example shows how to generate star (*)pyramid or triangle like given below using for loop.         Java Pattern 1   /* Output of the below program would be * ** *** **** *****  */   import java.io.*; public class JavaPyramidPattern1 { public static […] Continue reading →

What is a computer ?

Computer Definition A computer is a electronic device that accepts information and manipulates it or data. It has the ability to store, retrieve, and process data.   The term computer is derived from the Latin term “computare“, it means that It is a calculate machine or programmable machine. Computer can not do anything without a […] Continue reading →

Prime Number in Java

Write a Program in Java of Prime Number. Prime Number :- A number is called prime number if its not divisible by any number other than 1 or itself and you can use this logic to check whether a number is prime or not.   import java.util.*; class Prime { public static void main(String args[]) […] Continue reading →

Twisted Prime Number

Write a Program in Java of Twisted Prime Number. Twisted Prime Number :- If a number is prime, and its reverse number is also prime, then it is called Twisted prime number. For Example :- 37 is prime number , and its reverse order is 73 and 73 is also prime number.   import java.io.*; […] Continue reading →