0% found this document useful (0 votes)
37 views9 pages

Algorithm: Sequence of Steps That Give The Solution of A

The document describes several algorithms using a common structure of start, inputs, processes, and end. It includes examples of sequential, conditional, and cyclic algorithms. The sequential algorithms (Problems A-D) provide step-by-step instructions to calculate areas and perimeters of shapes. The conditional algorithms (Problems E-F) include if/then logic to determine outcomes based on number comparisons. The cyclic algorithms (Problems G-H) use loops to iterate through number sequences or calculations.
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)
37 views9 pages

Algorithm: Sequence of Steps That Give The Solution of A

The document describes several algorithms using a common structure of start, inputs, processes, and end. It includes examples of sequential, conditional, and cyclic algorithms. The sequential algorithms (Problems A-D) provide step-by-step instructions to calculate areas and perimeters of shapes. The conditional algorithms (Problems E-F) include if/then logic to determine outcomes based on number comparisons. The cyclic algorithms (Problems G-H) use loops to iterate through number sequences or calculations.
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/ 9

Algorithm: Sequence of steps that give the solution of a

problem.

Type of algorithm: sequential.


PROBLEM A.
Determine the area of a triangle.
1- Start.
2- To know the base and the height (b,h).
3- To calculate the area with the formula A= b*h/2.
4- To express or display the result.
5- End.
PROBLEM B.
Determine the perimeter of a rectangle.
1- Start.
2- To know the measure of the side of the rectangle
(a,b,c,d).
3- To calculate the perimeter with the formula P=a+b+c+d.
4- To express or display the result of the perimeter.
5- End.

PROBLEM C.
Convert any amount from pesos to dollars.
1- Start.
2- To know the amount of pesos to change (p)
3- To know the value of dollars (d)
4- To calculate the amount dividing the amount of pesos
over the value of the dollar ( R= P/D).
5- To express or display the result.
6- End.

PROBLEM D.
Calculate the area of a pentagon.
1- Start.
2- To know one side of the pentagon (s).
3- To know the measure of the apotem (AP).
4- To calculate the perimeter with the formula P=5s.
5- To calculate the area of the pentagon with the formula
A= P*AP/2 .
6- To express or display the result.
7- End.

Type of algorithm: Conditional.

PROBLEM E.
Determine if a person has the right to vote in the elections.
1- Start.
2- To know the age of the person (AG).
3- If the age is 18 or more go to step 4, else go to step 6.
4- Display the person can vote.
5- Go to step 7.
6- Display the person cannot vote.
7- End.

PROBLEM F.
Determine if a number is positive, negative or zero.
1- Start.
2- To know the number (n).
3- If n>0 go to step 4, else go to step 6.
4- Display or print the number is positive
5- Go to step 10 .
6- If N<0 go to step 7, else go to step 9.
7- Display or print the number is negative
8- Go to step 10.
9- Display or print the number is zero.
10End.

Type of algorithm: Cyclic.


PROBLEM G
Do an algorithm that prints the series of numbers from 1 to
10.
1- Start.
2- To give to the variable N the value of 0.
3- If N=10 go to step 7 else go to step 4.
4- To increment in 1 the variable N with the formula N=
N+1.
5- Print the variable N.
6- Go to step 3.
7- End.
PROBLEM H

Do an algorithm that prints the series of numbers from 1 to


10, and for each number print its respective square,
1- Start.
2- To give to the variable N the value of 0.
3- If N=10 go to step 7 else go to step 4.
4- To increment the variable N with the formula N=N+1.
5- Print the variable N, N2
6- Go to step 3.
7- End.

UNIVERSIDAD AUTONOMA DE NUEVO LEON

INTEGRATIVE ACTIVITY

Teacher: Ivan Zaleta


C) Do the algorithm and flowchart that calculate and print the
Factorial number. (CYCLIC)
1. Start.
2. To know the number N.
3. To give F the value of 1.
4. To give I the value of 1.
5. If I > N go to step 9 else go to 6.
6. To do the operation F= F*I.
7. To do the operation IF= I+1.
8. Go to step 5
9. To print the value of F.
10.
End.
START

N
F=1
F>N

I=1

F
TEND

F= F

B) Do the algorithm and flowchart which print the series of a


numbers from 1 to 10 and also when it finishes, print the
respective sum.
1- Start.
2- To give N the value of 1.
3- To give sum the value of 0.
4- If N>10 go to step 9 else go to 5.
5- To print N.
6- To do the operation SUM=SUM+N
7- To do the operation N=N+1.
8- Go to step $
9- Print the sum.
10- End.
Star
t
N=1

Sum=
0
N>10

End
SUM

SUM=
N=n+1
N SUM+N

123456-

If SUM<N go to step 9 else go to 13.


To print the value of SUM.
To do the operation A=B
To do the operation B=SUM
Go to step 7.
End.

Start
N

A=0
SUM=

A) Do the algorithm and flowchart which print the 0Fibonacci


series. The Fibonacci series is:
B=1
0,1,2,3,4,5,8,13,21,34,55,89,144.
7- Start.
8- To know the value of N.
A,B
9- To give A the value of 0.
10- To give SUM the value of 0.
11- To give B the value of 1.
SUM= A+B
12- To print the value of A and B.
13- To do the operation SUM=A+B.
If SUM<N go to step 9 else go to

SUM<N

END

SUM

A=
B
B=

A=0

SUM=
0
B=1

A,B

SUM= A+B

SUM<N
END

A=
SUM
B=

You might also like