0% found this document useful (0 votes)
322 views5 pages

Algorithm and Flowchart

This document provides algorithms and flowcharts for 5 simple math and logic problems: 1) Finding the sum of two numbers, 2) Finding the greatest of two numbers, 3) Checking if a number is even or odd, 4) Checking if a year is a leap year, and 5) Finding the greatest of three numbers. Each algorithm lists the steps and each flowchart shows the process visually with start, input, logic checks, output, and stop nodes.

Uploaded by

anish.t.p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
322 views5 pages

Algorithm and Flowchart

This document provides algorithms and flowcharts for 5 simple math and logic problems: 1) Finding the sum of two numbers, 2) Finding the greatest of two numbers, 3) Checking if a number is even or odd, 4) Checking if a year is a leap year, and 5) Finding the greatest of three numbers. Each algorithm lists the steps and each flowchart shows the process visually with start, input, logic checks, output, and stop nodes.

Uploaded by

anish.t.p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

01.

Find the sum of two numbers


Algorithm :

Step : 1 : Start the program

Step : 2 : Get the input values A and B

Step : 3 : sum C =A+B

Step : 4 : Print the output of C

Step : 5 : Display the result of C

Step : 6 : Stop the program

Flow chart :

START

READ A,B

SUM = A+B

PRINT SUM

STOP
02. Find greatest of two numbers
Algorithm :

Step : 1 : Start the program

Step : 2 : Get the values for A, B

Step : 3 : Find the greatest of two

(i) Check the condition (A>B) then display A is greater


(ii) Else display B is greater

Step : 4 : Store the greatest number of the two

Step : 5 : Display the greatest line of the two

Step : 6 : Stop the program

Flowchart :

START

READ A,B

IF A>B
YES

DISPLAY A IS GREATER
NO

DISPLAY B IS GREATER

STOP
03. To check whether the given number is even or odd
Algorithm :

Step : 1 : Start the program

Step : 2 : Get the value of A

Step : 3 : Process A % 2

Step : 4 : Display A is even if A%2 is true , else A is odd

Step : 5 : Stop the program

Flowchart :

START

GET A

NO IF A%2 YES

(==0)

A IS ODD A IS EVEN

STOP
04. To check whether the given year is a leap year
Algorithm :

Step : 1 : Start the program

Step : 2 : Get the value of A

Step : 3 : Process the data a%4

Step : 4 : Display a is a leap year if a%4 is true , else A is not a leap year

Step : 5 : Stop the program

Flowchart :

START

GET A

YES IF A%4(==0) NO

A IS A LEAP YEAR A IS NOT A LEAP YEAR

STOP
05. To check the greatest of three numbers
Algorithm :

Step : 1 : Start the program

Step : 2 : Get the values for A , B , C

Step : 3 : Find the greatest of the three

(i) Check the condition (A>B) and (A>C) if yes display A is greater
(ii) Check the condition (B>A) and (B>C) if yes display B is greater
(iii) Else display C is greater

Step : 4 : Store the greatest of the three numbers

Step : 5 : Display the greatest of value out of the three numbers

Step : 6 : Stop the program

Flowchart : START

READ A,B,C

NO IF(A>B) & (A>C) YES

DISPLAY A IS >

IF (B>A) & (B>C) YES

DISPLAY B IS >
NO

DISPLAY C IS >

STOP

You might also like