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

VIII Flowchart and Algorithms

The document outlines algorithms and flowcharts for various tasks, including checking the equality of line segments, determining voting eligibility based on age, verifying if three numbers form a Pythagorean triplet, and analyzing cricket match scores. It also includes flowcharts for checking divisibility of a number by 2 and 5, and for assessing the angles of a triangle to classify it. Each algorithm is presented with a step-by-step approach followed by a corresponding flowchart.

Uploaded by

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

VIII Flowchart and Algorithms

The document outlines algorithms and flowcharts for various tasks, including checking the equality of line segments, determining voting eligibility based on age, verifying if three numbers form a Pythagorean triplet, and analyzing cricket match scores. It also includes flowcharts for checking divisibility of a number by 2 and 5, and for assessing the angles of a triangle to classify it. Each algorithm is presented with a step-by-step approach followed by a corresponding flowchart.

Uploaded by

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

III.

Write algorithms and draw flowcharts for the


following
1. Accept the length of two different linesegments and check
whether they are equal or unequal. Display the message
accordingly.
Ans. Algorithm:
Step 1: Start
Step 2: Accept the length of two different line segments.
(say, A, B).
Step 3: Ifthey are equal then display "They are equal'.
Step 4: If they are unequal then display "They are unequal.
Step 5: Stop
Flowchart:

Start

Input A, B

Y
Is A=B? Display They are equal."/

Display "They are unequal."

Stop

he/she is
2. Accept the age of a person and check whether
eligible to vote or not. A person is eligible to vote only when
he/she is 18 years or more.
Ans. Algorithm:
Step 1: Start
Step 2: Accept the age of a person (say, Age).
Step 3: If Age is greater or equal to 18 years then display
'Eligible to vote'.
eligible
Step 4: If Age is less than 18 years then display 'Not
to vote.
Step 5: Stop
Flowchart:

Start

Input Age

Is Age>=18? Display"Eligible to vote"

Display "Not Eligible to vote"

Stop

3. Accept three numbers and check whether they are


Pythagorean Triplet' or not. Display the message accordingly.
(Hint: Use Pythagoras Formula for a Right Angled Triangle:
h= p'+b)
Ans. Algorithm:
Step 1: Start
Step 2: Accept three unequal numbers (say, A, B, CandC
is the greatest nunmber).
Step 3: Find the square of the greatest number.
Step 4: Find the sum of squares of the other two
Step 5: If the sum of the squares of numbers.
the two numbers
equal to the square of the third number then
display
Step Pythagorean
6: If the
sum of
Triplet.
the
equal to the square of thesquares of the two numbers is not
third number then display IN
a Pythagorean Triplet'
Step 7: Stop
Flowchart:

Start

Input three numbers A, B, C

Y
ls A²+B-c?? Display "Pythagorean Triplet"

Display "Not a Pythagorean Triplet"

Stop

IV. Draw flowcharts for the following:


stadium
1. In a cricket match, a viewer carries alaptop in the
batsman.
every day to keep record of the runs made by each
previous
When a player comes to bat, the viewer enters the
runs scored
runs made by the player. Further, he enters the
means
it
for each ball. When the runs entered on aball is -1,
runs made
the player is out. The laptop then displays the
the player in the cårrent innings as well as the total.
by out. Draw a
players are
The process continues untilall the
flowchart for the task stated above.
Ans. Start

runs; R1
Enterprevious

each ball; R2/


Enter runs scored for

Y R1=R1+CR
Is R2=-1?

N Display R1, CR
CR=CR+R2

Any more
player to batt?

Stop

2. Accept a numnber and check:


(a) whether the number is divisible by 2 and 5.
(b) whether the number is divisible by 2 but not by 5.
(c) whether the number is divisible by 5 but not by 2.
Display the message accordingly.
Ans.
Start

Accept anumber as N

Is N divisible Yes
Display "Number is
by 2 and 5? divisible by 2 and 5

No

Is N divisible Yes Display "Number is


by 2 and not divisible by 2 and not by 5
by 5?

No

Is N divisible Yes Display "Number is


by 5 and not divisible by 5 and not by 2H
by 2?
No

Stop

triangle
3. Input three angles of a triangle and check whether a
it is an
is possible or not. If possible, then check whether
'Acute-angled Triangle', 'Obtuse-angled Triangle' or a 'Right
angled Triangle'.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy