Program to print half pyramid using*

Out Put Format



Continue reading

How to find Leap Year in Java

Leap years are years where an extra, or intercalary, day is added to the end of the shortest month, February. The intercalary day, February 29, is commonly referred to as leap day. Leap years have 366 days instead of the usual 365 days and occur almost every four years.   Main.Java

  Output 1: […]

Continue reading

Find out middle index where the sum of both ends is equal.

Description: You are given an array of numbers. Find out the array index or position where the sum of numbers proceeding the index equals to the sum of numbers succeeding the index.

Output Starting from index 0, adding numbers till index 2 and adding rest of the numbers can be equal

Continue reading

Find out duplicate number between 1 to N numbers.

Description: You have got a range of numbers between 1 to N, where one of the number is repeated. You need to write a program to find out the duplicate number.

Output: Duplicate Number: 22

Continue reading

How to reverse Singly Linked List?

Description: Write a sample code to reverse Singly Linked List by iterating through it only once. Recursive Method: 1) Divide the list in two parts – first node and rest of the linked list. 2) Call reverse for the rest of the linked list. 3) Link rest to first. 4) Fix head pointer.

OutPut […]

Continue reading

Common Elements Between Three Arrays

Program: Write a program to find common elements between three arrays. Description: Write a program to identify common elements or numbers between three given arrays. You should not use any inbuilt methods are the list to find common values.

Output 3

Continue reading

Even Odd Number Example

Even Odd Number Example This Java Even Odd Number Example shows how to check if the given number is even or odd.

  Output of the program would be


Continue reading

Calculate Rectangle Area using Java Example

Calculate Rectangle Area using Java Example This Calculate Rectangle Area using Java Example shows how to calculate area of Rectangle using it’s length and width.

Output of Calculate Rectangle Area using Java Example would be


Continue reading