Data Type Identification and Conversion Programs
Data Type Identification and Conversion Programs
Indicate with an X which of the presented data are of the Integer type.
(X) 1000
( ) “)”
-900
True.
(X) -456
(X) 34
House 8
(X) 0
( ) .False.
( ) -1.56
Indicate with an X which of the data are of the Real type.
(X) -678
0.87
-9.12
True.
(X) -456
-99.8
Five
(X) 45.8976
False.
(X) -1.56
Indicate with an X which of the following data are of the Literal type.
( ) 678
0.87
-9.12
True
minus four hundred fifty-six
( ) -99.8
Five
( ) 45.8976
.False.
( ) 1.56
Indicate with an X which of the data are of the Logical type.
( ) -678
0.87
-9.12
True.
( ) -456
(X) .V.
Five
(X) . False.
(X) .F.
( ) -1.56
Mark with an X the valid names for a variable
(X) ADDRESS
( ) 21BRAZIL
( ) PHONE$COM
(X) USERNAME
(X) USER_NAME
( ) NAME*USER
( ) END*A-6
(X) CITY3
( ) #HEAD
Algorithm
Frame Diagram
Temperature_Converter_C_F_Program
Start
LeiaC
F = (9 * C + 160) / 5
Write Celsius and Fahrenheit
Film
Structured Portuguese
Temperature Converter Program C_F
Var
C, F: Integer
Start
LeiaC
F = (9 * C + 160) / 5
Write CCelsius = FFahrenheit
Film
Algorithm
Frames Diagram
Temperature_Converter_F_C_Program
Start
LeiaF
C = (F - 32) * (5/9)
Write Fahrenheit and Celsius
Film
Structured Portuguese
Temperature Converter Program C_F
Var
F, C:Inteiro
Start
LeiaF
C = (F - 32) * (5/9)
Write Fahrenheit = Celsius
Film
c. Calculate and present the value of the volume of a can of oil, using the
formula VOLUME ← 3.14159 * R ↑ 2 * HEIGHT.
Algorithm
Frame Diagram
Cylinder Volume Calculation Program
Start
LeiaR, A
V:= 3.14159*R^2*A
WriteV
Film
Structured Portuguese
Cylinder Volume Calculation Program
Var
R, AV:Real
Start
LeiaR
LeiaA
V = 3.14159 * R^2 * A
WriteV
Film
Algorithm
Frames Diagram
Fuel Cost Calculation Program
Start
Read TIME and AVERAGE SPEED
DISTANCIA:=TEMPO*VELOCIDADE_MEDIA
LITROS_USADOS:=DISTANCIA/12
EscrevaVELOCIDADE_MEDIA, TEMPO, DISTANCIA, LITROS_USADOS
Film
Structured Portuguese
Fuel Consumption Calculation Program
Var
TEMPO, VELOCIDADE_MEDIA, DISTANCIA, LITROS_USADOS :Real
Start
Read TIME
LeiaVELOCIDADE_MEDIA
DISTANCIA:=TEMPO*VELOCIDADE_MEDIA
LITROS_USADOS:=DISTANCIA/12
AVERAGE_SPEED
Write TIME
Write DISTANCE
Write USED_LITERS
Film
Algorithm
Frame Diagram
Installment Calculation Program
Start
READ VALUE, RATE, TIME
INSTALLMENT := VALUE + (VALUE * (RATE / 100) * TIME)
WRITE SERVICE
Film
Structured Portuguese
Payment Calculation Program
Var
VALOR, TAXA, TEMPO, RENDERING: Real
Start
LeiaVALUE
LeiaTAXA
ReadTIME
INSTALLMENT:=AMOUNT+ (AMOUNT * (RATE/100) * TIME)
Write SERVICE
Film
f. Read two values for the variables A and B, and swap their values.
so that variable A takes on the value of variable B and variable B
now take the value of variable A. Present the swapped values.
Algorithm
Diagram of Frames
Program_Swap_Values_A_B
Start
Leia A, B
C:=A
D:=B
A:=D
B:=C
WriteAeB
Film
Structured Portuguese
Program_ Exchange_Values_A_B
Var
A, BC, D:Real
Start
ReadA
LeiaB
C:=A
D:=B
A:=D
B:=C
Write A
WriteB
Film
g. Read four numbers and present the result of the addition and multiplication.
based on the use of the distributive property. That is, if
Given the variables A, B, C, and D, they must be added and multiplied by A.
B with A, C with A and D with A. Then B with C, B with D and finally C with D.
Algorithm
Frame Diagram
Sum_and_Product_Calculation_Program
Start
LeiaA, B, CeD
SOMA:=(A+B) + (A+C) + (A+D) + (B+C) + (B+D) + (C+D)
PRODUTO:=(A*B) * (A*C) * (A*D) * (B*C) * (B*D) * (C*D)
WRITE SUM and PRODUCT
Film
Structured Portuguese
Calculation_Sum_and_Product_Program
Var
A, B, C, D,SUM, PRODUCT: Real
Start
LeiaA
LeiaB
LeiaC
LeiaD
SUM := (A + B) + (A + C) + (A + D) + (B + C) + (B + D) + (C + D)
PRODUCT := (A*B) * (A*C) * (A*D) * (B*C) * (B*D) * (C*D)
Write SUM
WRITE PRODUCT
Film
Algorithm
Structured Portuguese
Volume_Calculation_Program
Var
COMPRIMENTO, LARGURA, ALTURA, VOLUME: Real
Start
Read LENGTH
Width
Height
VOLUME:=COMPRIMENTO * LARGURA * ALTURA
WriteVOLUME
Film
Algorithm
Frames Diagram
Square Calculation Program
Start
LeiaN
QUADRADO:=N^2
WRITE SQUARE
Film
Structured Portuguese
Square Calculation Program
Var
A,SQUARE: Integer
Beginning
LeiaA
SQUARE:=A^2
WriteSQUARE
Film
j. Read two integers (variables A and B) and print the result of the square of
difference of the first value from the second.
Algorithm
Input - Read the variables A and B
Processing - Calculate the difference between VariableA and VariableB and assign the value to
variávelD; elevar a variávelDao quadrado e atribuir o valor a variável
SQUARE_OF_THE_DIFFERENCE
Output - Display the value of the variable SQUARE_OF_DIFFERENCE
Frames Diagram
Difference_Square_Calculation_Program
Start
Read A, B
D=A-B
SQUARE_OF_THE_DIFFERENCE:=D^2
SQUARE_OF_THE_DIFFERENCE
Film
Algorithm
Frame Diagram
Dollar to Real Conversion Program
Start
ReadDOLLAR, QUOTATION
REAL:=DOLAR*COTAÇÃO
WriteREAL
Film
Structured Portuguese
Dollar_Real_Conversion_Program
Var
DOLAR, COTAÇÃO, REAL:Natural
Start
ReadDOLLAR
Read QUOTE
REAL:=DOLAR*COTAÇÃO
Write REAL
Film
Algorithm
Frames Diagram
Real to Dollar Conversion Program
Beginning
LeiaREAL, QUOTATION
DOLAR:=REAL*COTAÇÃO
Write DOLLAR
Film
Structured Portuguese
Real to Dollar Conversion Program
Var
REAL, QUOTATIONDOLLAR: Natural
Start
LeiaREAL
Read QUOTE
DOLAR:=REAL*COTAÇÃO
Write DOLLAR
Film
Algorithm
Frame Diagram
Sum_of_Squares_Program
Start
LeiaA, BeC
SOMA_DOS_QUADRADOS:=A^2+B^2+C^2
WRITE_SUM_OF_SQUARES
Film
Structured Portuguese
Sum_of_Squares_Program
Var
A, B, CSOMA_DOS_QUADRADOS:Inteiro
Start
LeiaA
LeiaB
LeiaC
SOMA_DOS_QUADRADOS:=A^2+B^2+C^2
WRITE_SUM_OF_SQUARES
Film
Algorithm
Frame Diagram
Program_Calculate_Square_of_the_sum
Start
LeiaA, BeC
SOMA:=A+B+C
QUADRADO_DA_SOMA:=SOMA^2
SQUARE_OF_THE_SUM
Film
Structured Portuguese
Program_Calculation_Square_of_the_sum
Var
A, B, C,R:Real
Start
LeiaA
LeiaB
LeiaC
R = (A + B + C)^2
Write
Film