Exercícios Voyage 200

4
[email protected] | www.fe.up.pt/ntiec | facebook.com/ntiec.feup Workshop Máquinas de Calcular Resolução dos exercícios propostos (Voyage 200) Exercício 1 Exercício 2 Irectangulo() Prgm Input 'base (m)',b Input 'altura (m)',h b*h^3/12 → I Disp "A inercia é "&string(I)&"" EndPrgm Itriangulo() Prgm Input 'base (m)',b Input 'altura (m)',h b*h^3/36 → I Disp "A inercia é "&string(I)&"" EndPrgm

Transcript of Exercícios Voyage 200

Page 1: Exercícios Voyage 200

[email protected] | www.fe.up.pt/ntiec | facebook.com/ntiec.feup

Workshop Máquinas de Calcular

Resolução dos exercícios propostos (Voyage 200)

Exercício 1

Exercício 2

Irectangulo()

Prgm

Input 'base (m)',b

Input 'altura (m)',h

b*h^3/12 → I

Disp "A inercia é "&string(I)&""

EndPrgm

Itriangulo()

Prgm

Input 'base (m)',b

Input 'altura (m)',h

b*h^3/36 → I

Disp "A inercia é "&string(I)&""

EndPrgm

Page 2: Exercícios Voyage 200

[email protected] | www.fe.up.pt/ntiec | facebook.com/ntiec.feup

Exercício 3

Exercício 4

Icirculo()

Prgm

Input 'raio (m)',r

π*r^4/4 → I

Disp "A inercia é "&string(I)&""

EndPrgm

Calculo_inercia()

Prgm

Dialog

Dropdown "Tipo de

seccao",{"Rectangular","triangular","Circular"},tipo

if tipo = 1 Then

Irectangular()

elseif tipo = 2 Then

Itriangular()

elseif tipo = 3 Then

Icircular()

Endif

EndPrgm

Page 3: Exercícios Voyage 200

[email protected] | www.fe.up.pt/ntiec | facebook.com/ntiec.feup

Exercício 5

medias()

Prgm

Dialog

Title "medias"

Request "1a Nota",n1

Request "2a Nota",n2

Request "3a Nota",n3

EndDlog

Expr(n1)→n1

Expr(n2)→n2

Expr(n3)→n3

If n1≥0 and n2≥0 and n3≥0 and n1≤20 and n2≤20 and n3≤20 Then

(n1+n2+n3)/3 → m

If m ≥ 10 Then

Disp "Aprovado"

Elseif m ≤ 5 Then

Disp "Reprovado"

Else

Disp "Pode ir a recurso"

EndIf

Else

Disp "Erro: as notas tem de estar entre 0 e 20"

EndIf

EndPrgm

Page 4: Exercícios Voyage 200

[email protected] | www.fe.up.pt/ntiec | facebook.com/ntiec.feup

Exercício 6

Exercício 7

ac(d)

Func

π*d^2/4

EndFunc

formres()

Prgm

Input "No. de vezes",n

for i,1,n,1

Input "a",a

Input "b",b

Input "c",c

If a = 0 Then

Disp "Erro: a nao pode ser nulo"

Elseif (b^2-4*a*c) < 0 Then

Disp "Raiz nao existente"

Else

(-b + (b^2 - 4*a*c)^0.5)/(2*a)→x1

(-b - (b^2 - 4*a*c)^0.5)/(2*a)→x2

Disp "x = "&string(x1)""

Disp "ou"

Disp "x = "&string(x2)""

EndIf

Endfor

EndPrgm