0% found this document useful (0 votes)
6 views22 pages

Flowcharts and Pseudocode for Algorithms

The document outlines various algorithms represented through flowcharts and pseudocode for calculating different scenarios such as the area of a triangle, currency conversion, age determination, parking charges, painting costs, hypotenuse calculation, ticket pricing, travel time, call costs, water and electricity payments, discounts, savings, travel expenses, electrical power, cake preparation, square area, student averages, and lifespan calculations. Each algorithm includes steps for input, processing, and output. The document serves as a comprehensive guide for implementing these calculations programmatically.

Translated by

ScribdTranslations
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)
6 views22 pages

Flowcharts and Pseudocode for Algorithms

The document outlines various algorithms represented through flowcharts and pseudocode for calculating different scenarios such as the area of a triangle, currency conversion, age determination, parking charges, painting costs, hypotenuse calculation, ticket pricing, travel time, call costs, water and electricity payments, discounts, savings, travel expenses, electrical power, cake preparation, square area, student averages, and lifespan calculations. Each algorithm includes steps for input, processing, and output. The document serves as a comprehensive guide for implementing these calculations programmatically.

Translated by

ScribdTranslations
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

2.

1 Create a flowchart and pseudocode that represent the algorithm to obtain the
area of a triangle.

1start
2 enter Base and Height.
3 to do Area = (Base * Height) / 2.
4 write Area
5 fin

Start

Base=
Altura=

Area = (Base * Height) / 2

Area=

End
2.2 An importing company wants to determine how many dollars it can acquire with X
amount of Mexican money. Create a flowchart and pseudocode that represent the
algorithm for such purpose.

1 start
2 read exchange rate, Mexican pesos.
3 if Mexican pesos >= the exchange price. Then
Dólares= pesos mexicanos*precio de cambio
you can acquire Dollars
If not
We do not show that Mexican pesos are not enough to buy a dollar.
4 fin

Start

Exchange rate=
Mexican pesos

yes no
Pesos
Mexicans >= Price of
change

The Mexican pesos


Dollars = Mexican pesos * exchange rate are not sufficient for
buy a dollar

Dolar=

End
A company that hires staff needs to determine the age of the people who apply.
They work, but when they are interviewed, they are only asked the year they were born.
Create the flowchart and pseudocode that represent the algorithm to solve this.
problem.

1 start

2 empty year of birth

3 approximate age = current year - year of birth

4 write Age

5 fin

Start

Año de Nacimiento=
Current year=

Age = Current year - Year


of Birth

Edad=

Fin
2.4 A parking lot needs to determine the charge it should apply to the people who use it.
they use. Consider that the charge is based on the hours they have available and that the fractions of
hours are considered complete and I made a flowchart and pseudocode that represent the
algorithm that allows determining the charge.

1 Start
2 read hour, minute and cost per hour
3 if minutes is = 0 then
total cost = hours * cost per hour
if not
horas= hora+1
total cost = hours * cost per hour
5 write 'total to pay' total cost
6 fin

Start

Hora=
Minutos=
Costo de horas=

yes no
Minutos = 0

costo total= hora * costo de horas hours = hour + 1


costo total= horas * costo de horas

write 'total to
pay total cost

End
2.5 Paintings 'The thick brush' needs to determine how much to charge for painting jobs.
Consider that payment is charged per square meter and create a flow diagram and pseudocode that represent the
algorithm that allows you to generate budgets for each client.

1 start
2 square meters to paint, price per square meter

3 total amount to pay = m2 to paint * price per m2

4 write 'budget for the work is:' total to pay

5 fin

Start

M2 to the peak=
Precio del M2=

total a pagar=m2 a pintar * precio del m2

budget for the


work is: total to
to pay

End
2.6 It is required to determine the hypotenuse of a right triangle. What would the diagram be like?
flow and the pseudocode that represent the algorithm to obtain it? Remember that according to Pythagoras
Set that: C2 = A2 + B2.

1 start

2 read leg1 or leg2

3 find hypotenuse = SQRT(side1^2 + side2^2)

the hypotenuse of this triangle is hypotenuse

5 fin

Start

Cateto1=
Cateto2=

hipotenusa= SQRT(Cateto1^2+Cateto2^2)

The hypotenuse is:


hypotenuse

End
2.7 The bus company 'La curva loca' needs to determine the cost of the ticket.
from a simple trip, this based on the kilometers to be traveled and the cost per kilometer. Make
a flowchart and pseudocode that represent the algorithm for that purpose.

1 start

2 empty km traveled, cost per km


3 create ticket = kilometers traveled * cost per kilometer

the cost of the ticket is: ticket

5 fin

Start

km recorrido=
costo km=

boleto=km recorrido*costo km
km

the cost of the ticket is: ticket

End
2.8 It is required to determine the time it takes for a person to travel from one city to another in
bicycle, considering that it moves at a constant speed. Create a flow diagram and
pseudocode that represents the algorithm for that purpose.

1 inico
2 read speed and distance
3 time = distance / speed
4 write 'the time I took is:' time
5 fin

Start

km recorrido=
costo km=

ticket=km traveled*cost per km


km

the ticket cost is: ticket

End
2.9 It is necessary to determine the cost of making a phone call based on the
duration of the call and the cost per minute. Create a flowchart and pseudocode
that represent the algorithm for this purpose.

1 start
2 read minimum cost and duration

3 calculate call cost = cost per minute * call duration

The cost of the call is: call cost

5 fin

Start

Minimum cost=
Duracion=

call cost = cost per minute * call duration in minutes

the cost of the call is: cost


call

End
2.10 The CONAGUA needs to determine the payment that a person must make for the total of
cubic meters of water consumed. Create a flowchart and pseudocode that
represent the algorithm that allows to determine that payment.

1 start

2 leer costo Metrocubo, Metrocubo consumido


3 make payment = cost per cubic meter * cubic meters consumed

the total to pay is: payment

5 fin

Start

cost Metrocubo =
Metrocube
consumido =

payment = cost per cubic meter * cubic meters consumed

the total to pay is: payment

End
2.11 The company of light and shadows (CLS) needs to determine the payment it must make.
person for electricity consumption, which is measured in kilowatts (KW). Carry out a
flowchart and pseudocode that represent the algorithm that allows determining that payment.

1 start
2 read costKW, EnergyConsumption
3 make Pay = costKW * EnergyConsumption
Total to pay: Pay
5 fin

Start

costoKW =
ConsumoEnergia =

Pay = costKW * EnergyConsumption

total a pagar: Pagar

End
2.12 Create a flowchart and pseudocode that represent the algorithm to determine
how much will a person finally pay for a certain item, considering that they have a
20% discount, and must pay 15% VAT (must show the price with discount and the price
final).

1 start
2 read ValueArticle, Name
3 hacer PrecioDescuento= ValorArtculo -( (ValorArtculo *20)/100)
PrecioConIVA= PrecioDescuento +(( PrecioDescuento*15)/100)
4 Write "the discounted price is: "DiscountedPrice" and the final price is: "PriceWithVAT
5 fin

Start

ValorArtculo =
Nombre=

PrecioDescuento= ValorArtculo -( (ValorArtculo *20)/100)


PrecioConIVA= PrecioDescuento +(( PrecioDescuento*15)/100)

the discounted price is:


PrecioDescuento. el precio final es:
PrecioConIVA.

End
2.13 Create a flowchart and pseudocode that represent the algorithm to determine
How much money does a person save in a year if they consider saving 15% of their income every week?
salary (consider four weeks per month and that the salary does not change).

1 indication

2 read Salary
3 make QuinceSemana = ((Salary.15) / 100)
Dineroxaño=Quincesemana*48
Money saved per year: "MoneyYear
5 fin

Start

Salario=

QuinceSemana=((Salario.15)/100)
Dineroxaño=Quincesemana*48

Money saved per year: Moneyyear

End
2.14 A company wishes to determine the amount of a check that it must provide to one of its
empleados que tendrá que ir por equis número de días a la ciudad de Monterrey; los gastos que
the company's coverage includes: hotel, food, and 100.00 pesos daily for other expenses. The amount must be
broken down for each concept. Create a flowchart and pseudocode that represent the
algorithm that determines the amount of the check.

1 start
2 read HotelCost, FoodCost, Days
3 Make TotalHotel=HotelCost*Days
TotalComida=CostoComida*Dias
TotalOtrosGastos=100*Dias
CostPerDay=Days*(HotelCost+FoodCost+100)
4 Write 'the total spending on food is: 'TotalFood.
The total expenditure for the hotel is: TotalHotel.
The total of other expenses is: TotalOtherExpenses.
Total Check Amount: CostXDay
5 Fin

Start

CostoHotel=
CostoComida=
Dias =

TotalHotel=CostoHote*Dias
TotalComida=CostoComida*Dias
TotalOtrosGastos=100*Dias
CostPerDay=Days*(HotelCost+FoodCost+100)

The total food expense is: TotalComida.


The total expenditure is Hotel: TotalHotel.
the total of other expenses is : TotalOtherExpenses.
Total Check Amount: CostPerDay.

End
2.15 The electrical power of the circuit in figure 2.6 is to be calculated. Create a flowchart.
and the pseudocode that represents the algorithm to solve the problem. Consider that: P = V * I
y V = R*I.

1 start
2 read AlternatingCurrent
3 make Voltage=4*AlternatingCurrent
Power = Voltage * Alternating Current
The electrical power of the circuit is: Power
5 Fin

Start

CorrienteAlterna=

Voltage=4*AlternatingCurrent
Power = Voltage * Alternating Current

The electrical power of the circuit is:

End
2.16 Create pseudocode and flowchart that represent the algorithm to prepare a
[Link]://[Link]/[Link]

1 Start
2 ingredients
2 Ingredients 500 grams of butter = (M) 5
1 kilogramo de azúcar=(Az )9
1 kilogram of prepared flour = (Hp)
8 units of eggs = ( Hu)
1 liter of milk = (Le)
1 teaspoon of vanilla = (Va)
Utensils
Horno=0
MixingContainer1
3 to do
----
RecipienteMescla1=M+Az
Blanquecino= RecipienteMescla1
If MixingContainer1 <> Whitish
Make ContainerMix1=M+Az
If not
Make MixingContainer1 = MixingContainer1 + 1
----
Make MixingContainer2 = MixingContainer1 + Hu + Hp + Le
Homogénea= RecipienteMescla2
If MixingContainer2 <> Homogeneous
Make MixingContainer2 = MixingContainer1 + Hu + Hp + Le
If not
Make MixingContainer2 = MixingContainer2 + Va
-----
ContainerMix3 = (ContainerMix3 + m) + ContainerMix2
----
If oven<>150
Oven=Oven+1
If not
Oven=Oven+ MixtureContainer3
Tiempo=45
If Time<>0
Make Time=tempo-1
If not
To do
ContainerMix3 = ContainerMix3 + 1
Horno=Horno- RecipienteMezcla3
4 Write ContainerMix3
5 Fin
start

RecipienteMescla1=M+Az
Blanquecino= RecipienteMescla1

Yes
Recipient
Mix1
<>
I whitened
no
RecipienteMescla1=M+Az RecipienteMescla1=
MixingContainer1+1

Make ContainerMix2=
MixContainer1+Hu+Hp+Le

Homogénea= RecipienteMescla2

Yes
Recipient
eBlend1
<>
I whitened
no
RecipienteMescla1=M+Az RecipienteMescla1=
ContainerMix1+1
Create the flowchart and pseudocode that represent the algorithm to find the area
of a square. Area = (diagonal^2)/2

1 Start
2 empty diagonal
3 Area = (diagonal^2)/2
4 Write "the diagonal is: " Area
5 Fin
Start

Diagonal=

Area = (diagonal^2) / 2

the diagonal is: Area

End
2.20 Create the flowchart and pseudocode that represent the algorithm to determine the
average that a student will obtain considering that they take three exams, of which the
The first and the second have a weighting of 25%, while the third has 50%.

1 Home
2 read Note1, Note2, Note3
3 make Note1=Note1*1.25/5
Grade2=Grade2*1.25/5
Nota3=Nota3*2.5/5
NotaTotal=Nota1+Nota2+Nota3
Average is: TotalScore
5 fin
Start

Nota1, Nota2, Nota3

Score1 = Score1 * 1.25 / 5


Nota2=Nota2*1.25/5
Nota3=Nota3*2.5/5
NotaTotal=Nota1+Nota2+Nota3

average is: TotalGrade

End
2.21 Create a flowchart and pseudocode that represent the algorithm to determine
approximately how many months, weeks, days, and hours has a person lived.

1 Start

2 Read BirthDay, BirthMonth, BirthYear, CurrentDay, CurrentMonth, CurrentYear

If BirthMonth >= CurrentMonth

Make LessMonth = MonthBorn - CurrentMonth

Who
Make LessMonth = CurrentMonth - BirthMonth

--

If BornDay >= CurrentDay

Make LessDays = DayBorn - CurrentDay

Who

Hacer MenosDias= DiaActual- DiaNacido

--

If YearBorn >= CurrentYear

Make TotalYear = BirthYear - CurrentYear

Who

Make TotalYear = CurrentYear - YearBorn

--
Years*12=Months - LessMonth=TotalMonths

4*TotalMonths=Weeks

31 * TotalMonths = Days - LessDays = TotalDays

24*TotalDays=TotalHours

4 Escribir MesesTotal,Semanas,DiasTotales,HorasTotales

5 Fin

2.22 An algorithm is required to determine the cost of making a phone call.


based on the duration of the call and the cost per minute. Represent the solution
through the flowchart and pseudocode.
1 Start
2 Read TimeCall, CostMinute
3 Make TotalCost = CallTime * MinuteCost
Write "the cost of the call is: " TotalCost
5 Fin

Start

TiempoLlamada, CostoMinuto

CostoTotal= TiempoLlamada*CostoMinuto

The cost of the call is: TotalCost

End

2.23 The hotel 'Cama Arena' needs to determine what it should charge a guest for their
stay in one of its rooms. Create a flowchart and pseudocode that represent
the algorithm to determine that charge.

1 Inico
2 Read Consumption, CostRoom, Days
3 make Charge = (Consumption + RoomCost) * Days
The total charge is:
5 fin
Start

Consumo, CostoCuarto,Dias

Cobro=( Consumo+CostoCuarto)*Dias

the total charge is: Charge

End

You might also like