Friday, July 7, 2017

Java Programs

Here is a list of basic java programs which are often required to know either for interviews or for any java test or exam.

Fibonacci Sequence


                      In fibonacci sequence, the next number is the sum of the previous two numbers. The first two numbers are 0 and 1. Example : 0, 1, 1, 2, 3, 5, 8, 13 etc...

Number Palindrome


                            Palindrome number is a number that remains the same when its digits are reversed. Example: 67876

Palindrome


                              Palindrome refers to a word that doesn't change when its letters are reversed.Example : racecar

Armstrong Number

                               An n-digit number equal to the sum of the nth powers of its digits. A 3 digit positive integer is called an armstrong number if the sum of cubes of the individual digits is equal to that number. Example: 153: 13 + 53 + 33 = 153

Array Left Rotation

                      Left rotate the array of "m" elements, "n" number of times.
Example:
Input:m = 7 ; n = 4
I/P Array : [5,4,3,6,7,8,9]
O/P Array: [7,8,9,5,4,3,6]

Prime Number

                         Algorithm to find out if the given number is Prime Number or Not.


No comments:

Post a Comment