Learning the operators of the Java programming language is a good place to start. Operators are special symbols that perform specific operations on one, two, or three operands, and then return a result. Increment/Decrement operators: Increment and decrement operators are known as Unary operators. They require only one operand. Increment operator:… Continue Reading Java program for increment and decrement (pre and post)

In programming, we execute certain section of code based on whether the specified condition is true or false which is known only at run time. For such cases we use “control flow statements”. Simple if if……else nested if if else if Simple if: Simple If statement is the most basic… Continue Reading Java program to implement simple if-else

Factorial: Factorial of a non-negative integer n, is the product of all positive integers less than or equal to n.  It is represented as n!. n! = 1 * 2 * 3 * 4 * ………………… * (n-1) * n. for example,  5! can be calculated as 5 * 4… Continue Reading Java program to find Factorial of a given number using Recursion

This program explains about how you can  swap  values within a variable without using the third variable. Algorithm: Step 1 : START Step 2 : Declare two variables, say a,b. Step 3 : Add a and b and store to a. Step 4 : Subtract b from a and store… Continue Reading Java program to swap two variables without using third variable

The Factorial of a non-negative number n is the product of all positive integers less than or equal to n and is represented by n!. n! = 1 * 2 * 3 * 4 * 5 * ………………………..  * (n-1) * n. for example 5! can be calculated as 1… Continue Reading Java program to find factorial of a given number

In this program, user is asked to enter two integers. Then, the product of those two integers is stored in a variable and displayed on the screen. Algorithm: Step 1: Start. Step 2: Declare variables, say a and b. Step 3: result = a * b. Step 4: Display result.… Continue Reading Java Program to find product of two numbers

Square frame pattern is designed in accordance to the number of rows user has entered. In this java program, the user is asked to enter number of rows. It displays a hallow square based on number of rows. Algorithm: Step 1: Start. Step 2: Read number of rows to be… Continue Reading Java Program to print Hallow square pattern

A number is said to be even if it is divisible by 2.  otherwise odd. Let us now see an example of a java program to determine whether the given number is an odd or even number. Algorithm: Step 1: Start. Step 2:  Read n. Step 3:  if n%2 ==… Continue Reading Java program to check whether the given number is even or odd

A series of numbers in which each number is the sum of the two preceding numbers. for example 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 etc. The first two numbers of fibonacci series are 0 and 1. Algorithm: Step 1: START. Step 2: Declare variables a,b,c.… Continue Reading Java program to Generate Fibonacci sequence