0% found this document useful (0 votes)
434 views

Algorithm: 1. Check Whether The Given Age Is Eligible For Voting

The document describes 5 algorithms: 1) check voter eligibility based on age, 2) compare two numbers and print the bigger, 3) swap two numbers without a third variable, 4) swap two numbers using a third variable, and 5) calculate and print the area and circumference of a circle given the radius. Each algorithm is listed as a series of steps to start, perform a calculation or comparison, and stop.

Uploaded by

swaran-52
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)
434 views

Algorithm: 1. Check Whether The Given Age Is Eligible For Voting

The document describes 5 algorithms: 1) check voter eligibility based on age, 2) compare two numbers and print the bigger, 3) swap two numbers without a third variable, 4) swap two numbers using a third variable, and 5) calculate and print the area and circumference of a circle given the radius. Each algorithm is listed as a series of steps to start, perform a calculation or comparison, and stop.

Uploaded by

swaran-52
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/ 3

Algorithm

1. Check whether the given age is eligible for


voting:
Step 1: Start
Step 2: Read age from user
Step 3: If age greater than or equal to 18, then
print age is eligible for voting. Otherwise print age is
not eligible for voting
Step 4: Stop

2. Find the biggest among two numbers:


Step 1: Start

Step 2: Read two numbers a, b from user

Step 3: If a greater than b, then print a is


greater. Otherwise print b is greater.
Step 4: Stop
3. Swapping two numbers without using third
variable:
Step 1: Start
Step 2: Read two numbers a, b from the user.
Step 3: Add the value of a and b and store the
result in a.
Step 4: Subtract the value of b from a and
store the result in b.
Step 5: Subtract the value of b from a and
store the result in a.
Step 6: Put the value of a and b after
swapping.
Step 7: Stop.

4. Swapping two numbers using third variable:


Step 1: Start
Step 2: Read the numbers a and b from the
user
Step 3: Store the value of a to c
Step 4: Store the value of b to a
Step 5: Store the value of c to b
Step 6: Print the values of a and b
Step 7: Stop

5.Find the area and circumference of a circle:


Step 1: Start
Step 2: Read the radius from the user
Step 3: Calculate area is equal to 3.14*r*r
Step 4: Calculate circumference is equal to
2*3.14*r
Step 5: Print the values of area and
circumference
Step 6: Stop

You might also like