In this post, we will see an algorithm and flowchart to add two numbers. It will be applicable to write program in any programming language. Required knowledge: Basics of Algorithm writing and flowchart drawing. Algorithm: Step 1: Start Step 2: Declare variables num1, num2 and sum. Step 3: Read values… Continue Reading Algorithm and Flowchart to add two numbers

In this post, we will see a C Program to read two number inputs from user and display the sum. The program below accepts two numbers from user and perform basic arithmetic operation(addition) using + operator and display the sum on screen. For algorithm & flowchart to add two numbers,… Continue Reading C PROGRAM TO ADD TWO NUMBERS / INTEGERS

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