# Top 50 Java Programs

How to create Hello World Program in Java.

Variables Initialization Program in Java

Operators Program in Java, Java Unary Operator Example: ++ and –,Java Arithmetic Operator Example, Java AND Operator Example: Logical && and Bitwise &

Fahrenheit to Celsius Program in Java

Marks Average Program in Java

Simple Interest = (Princple * Rate * Time)/100

Find Area Circle Program in Java, Area of Circle = (22/7) X radius x radius

Find Area of Rectangle Program in Java

Swapping Program in Java

Swapping with Two Variables Program in Java

Increment Decrement Operators Program in Java

Duplicate Words in String Program in Java

Binary Search Program in Java

Equal Number Program in Java

Even Odd Program in Java

Greater Number Program in Java

Greatest Number Program in Java

Leap Year is the year that the remaining zero is divided by 4 will be a leap year, but only that century will be a leap year, which is completely divided by 400.

Passing Division Program in Java

A person can votes if age is greater than or equal to 18.

Java Operators Program in Java

A positive number is called armstrong number if it is equal to the sum of cubes of its digits. Examples: 153 is Armstrong, (1*1*1)+(5*5*5)+(3*3*3) = 153

An Automorphic number is a number whose square “ends” in the same digits as the number itself.

Examples: 5*5 = 25, 6*6 = 36, 25*25 = 625

A number is said to be Buzz Number if it ends with 7 or is divisible by 7.

Example: 1007 is a Buzz Number.

A circular prime is a prime number with the property that the number generated at each intermediate step when cyclically permuting its digits will be prime. For example, 1193 is a circular prime, since 1931, 9311 and 3119 all are also prime.

Two integers a and b are said to be relatively prime, mutually prime, or coprime if the only positive integer that divides both of them is 1. Example: 13 and 15 are co prime.

import java.util.Scanner; public class DigitToWord { public static void main(String[] args) { // TODO code application logic here int r, […]

A Duck number is a number which has zeroes present in it, but there should be no zero present in the beginning of the number. For example 3210

A Duck number is a number which has zeroes present in it, but there should be no zero present in the beginning of the number. For example 3210

Factor a number or algebraic expression that divides another number or expression evenly—i.e., with no remainder. For example, 3 and 6 are factors of 12 because 12 ÷ 3 = 4 exactly and 12 ÷ 6 = 2 exactly. The other factors of 12 are 1, 2, 4, and 12.

Factors of 12: 1, 2, 3, 4, 6, 8, 12.

A series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 0, 1, 1, 2, 3, 5, 8, etc.

Floyd Triangle Program in Java 1

2 3

4 5 6

7 8 9 10

11 12 13 14 15

the greatest common divisor (gcd) of two or more integers, which are not all zero, is the largest positive integer that divides each of the integers. For example, the gcd of 8 and 12 is 4.

A happy number is a natural number in a given number base that eventually reaches 1 when iterated over the perfect digital invariant function for. Those numbers that do not end in 1 are -unhappy numbers.

In mathematics, a harshad number (or Niven number) in a given number base is an integer that is divisible by the sum of its digits when written in that base.

The least common multiple, lowest common multiple, or smallest common multiple of two integers a and b, usually denoted by LCM(a, b), is the smallest positive integer that is divisible by both a and b.

If a number=1234, then 1*2*3*4 ,Multiply of digit=24, Multiply Of Digit Program in Java

A neon number is a number where the sum of digits of square of the number is equal to the number. For example if the input number is 9, its square is 9*9 = 81 and sum of the digits is 9. i.e. 9 is a neon number.

In mathematics, a Niven number (or harshad number) in a given number base is an integer that is divisible by the sum of its digits when written in that base.

A palindromic number is a number that remains the same when its digits are reversed. Like 16461, for example,

A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. For instance, 6 has divisors 1, 2 and 3, and 1 + 2 + 3 = 6, so 6 is a perfect number.

A prime number is a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only ways of writing it as a product, 1 × 5 or 5 × 1, involve 5 itself.

If a number=1234, then reverse of number is 4321.

A number is said to be special number when the sum of factorial of its digits is equal to the number itself. Example- 145 is a Special Number as 1!+4!+5!=145.

A spy number is a number where the sum of its digits equals the product of its digits. For example, 1124 is a spy number, the sum of its digits is 1+1+2+4=8 and the product of its digits is 1*1*2*4=8.

If a number enter 5462 then sum of theses digits 5+4+6+2 = 17.

A twin prime is a prime number that is either 2 less or 2 more than another prime number—for example, either member of the twin prime pair (41, 43). In other words, a twin prime is a prime that has a prime gap of two.

A number is called a twisted prime number if it is a prime number and reverse of this number is also a prime number.

A number is said to be unique , if the digits in it are not repeated. for example, 12345 is a unique number. 123445 is not a unique number.

Menu Driven Program in Java

Menu Driven Program in Java

Vowels Character Program in Java

Name Of Month in Program Java

Pattern Type One Program in Java

Pattern Type Two Program in Java

Pattern Type Three Program in Java

Pattern Pyramid Program in Java

Pattern Reverse Pyramid Program in Java

Pattern Diamond Program in Java

Number Series Program in Java

Even Number Series Program in Java

Odd Number Series Program in Java

Square Number Series Program in Java

Square Post Number Series Program in Java

Square Pre Number Series Program in Java

A number is called Disarium number if the sum of its power of the positions from left to right is equal to the number.

Example: 1 + 3*3 + 5*5*5 = 1 + 9 + 125 = 135

A tech number can be tech number if its digits are even and the number of digits split into two number from middle then add these number if the added number’s square would be the same with the number it will called a Tech Number. If the number is split in two equal halves,then the square of sum of these halves is equal to the number itself. Write a program to generate and print all four digits tech numbers. Note: If number of digits is not even then it is not a tech number.

Merge Array Program in Java

Loop based output questions

First Array Program in Java

Reverse Array Program in Java

Smallest in Array Program in Java

Largest in Array Program in Java

Linear Search Program in Java

Bubble Sort Program in Java to sort numbers of an array in ascending or descending order.

Matrix Program in Java

Matrix Multiplication Program in Java

Pattern Space Pyramid Program in Java

Define a class called Mobike with the following description:

Instance variables/data members:

String bno – to store the bike’s number(UP65AB1234)

String name – to store the name of the customer

int days – to store the number of days the bike is taken on rent

int charge – to calculate and store the rental charge

Member methods:

void input( ) – to input and store the detail of the customer.

void compute( ) – to compute the rental chargeThe rent for a mobike is charged on the following basis.

First five days Rs 500 per day;

Next five days Rs 400 per day

Rest of the days Rs 200 per day void display ( ) – to display the details in the following format:

Bike No. PhoneNo. No. of days Charge

Prime Number Up to N Terms Program in Java. Ex: Enter size of prime=5

Number is prime=2

Number is prime=3

Number is prime=5

Number is prime=7

Number is prime=11

Number is prime=13

Magic number is the if the sum of its digits recursively are calculated till a single digit If the single digit is 1 then the number is a magic number. Magic number is very similar with Happy Number.

A number is said to be a pronic number if product of two consecutive integers is equal to the number, is called a pronic number.

Example- 42 is said to be a pronic number, 42=6×7, here 6 and 7 are consecutive integers

A number is said to be an Ugly number if positive numbers whose prime factors only include 2, 3, 5.

For example, 6(2×3), 8(2x2x2), 15(3×5) are ugly numbers while 14(2×7) is not ugly since it includes another prime factor 7. Note that 1 is typically treated as an ugly number.

**Recent Posts**