Algorithms: Sequential
Algorithms: Sequential
*sequential
Problem a)
1.2.3.4.5.P.
6.-
Start
Read the value of side A, store it in the variable SA.
Read the value of side B, store it in the variable SB.
Calculate the perimeter with the following operation P = 2*SA+2*SB
Write or display the result of the operation, which was stored in the variable
End
Problem b)
1.- Start
2.- Read the value of pesos, store it in the variable P.
3.- Read the constant 13.
4.- Calculate the conversion with the following operation Dlls=P/13.
5.- Write or display the result of the operation, which was stored in the variable
Dlls.
6.- End.
Problem c)
1.- Start
2.- Read the value of perimeter, store it in the variable P.
3.- Read the value of apothem, store it in the variable a.
4.- Calculate the area with the following operation A=(P*a)/2.
5.-Write r display the result of the operation, which was stored in the variable A.
6.- End.
Problem d)
1.2.3.4.5.6.Vf.
7.-
Start.
Read the value of original velocity, store it in the variable Vo.
Read the value of acceleration, store it in the variable a.
Read the value of time, store it in the variable t.
Calculate the final velocity with the following operation Vf=Vo+a(t)
Write or display the result of the operation which was stored in the variable
End.
*Conditional
Problem e)
1.2.3.4.5.6.-
Start.
Ask the age of the person.
Compare the age (age is greater or equal to 18 years old) then
Yes: the person has the right to vote, go to step 6.
No: the person does not have the right to vote.
End.
Problem f)
1.2.3.4.5.6.-
Start.
Ask the average of the student.
Compare the average (average is greater or equal to 70) then
Yes: the student approved, go to step 6.
No: the student did not approved.
End.
Problem g)
1.2.3.4.5.6.7.8.9.-
Start.
Ask the number.
Compare the number (number is equal to 0) then
yes: the number is Zero, go to step 9.
No: go to step 6.
Compare the number (number is greater than 0) then
yes: the number is positive, go to step 9.
No: the number is negative.
End.
*Cyclic
Problem h)
1.-Start.
2.- Give the counting variable N the value of (zero).
3.- If N=10 go to step 7 else go to step 4.
4.- Raise to the square the variable N with the formula N=N.
5.- Print the value of N.
6.- go to step 3.
7.- End.
Problem i)
1.2.3.4.5.6.7.8.-
Start.
Give the counting variable N the value of (Zero).
If N=20 go to step 8 else go to step 4.
Divide the counting variable N with the formula N=N/2.
Compare the result (reminder = 0) then
Yes: It is an even number, go to step 8.
No: It is an odd number.
End.