View
214
Download
0
Category
Preview:
Citation preview
8/16/2019 Problema 2.Trabajo 2
1/5
Alumno: Miguel Angel Ruiz YactayoCódigo: 20141147B
a) PSEUDOCODIGO DEL PROBLEMA 1
1. -Variables a utilizar : a,b,c,r1,r2,n
2. Resolver la ec. cuadrática de la forma ax2 + bx +c.
3. Leer a
. Leer b
!. Leer c
". #i la discriminante de la ec. :$ositiva
√ b
2
−4ac>0
%ntonces las ra&ces son reales ' diferentes
(. #i la discriminante de la ec. :ne)ativa
√ b2
−4ac
8/16/2019 Problema 2.Trabajo 2
2/5
Alumno: Miguel Angel Ruiz YactayoCódigo: 20141147B
c) CODIGO FUENTE
SI DISCRMINANTE
>0
SI DISCRMINANTE
=0
RAICESREALES Y SI DISCRMINANTE
=0SISIN
RAICES
REALES ESI
SI DISCRMINANTE
8/16/2019 Problema 2.Trabajo 2
3/5
Alumno: Miguel Angel Ruiz YactayoCódigo: 20141147B
include /iostream0
include /cmat0
usin) names$ace std
int main 45
float a,b,c,r1,r2,n
cout // 6 Resolver la ec. cuadratica de la forma ax2 + bx +c6 // endl
cout // 6 n)rese a, b ' c, donde a es diferente cero6 // endl
cin 00 a 00 b 00 c
if s7rtb8b - 8a8c4094 5
cout // 6 las raices son reales ' diferentes6 // endl
r1 -b + s7rtb8b - 8a8c444;28a4
r2 -b - s7rtb8b - 8a8c444;28a4
cout //6 las soluciones son : 6 // r1 // 6 ' 6 // r2
<
else if s7rtb8b - 8a8c4 94 5
cout // 6 las raice son reales e i)uales6 //endl
r1 b;28a4
r2 r1
cout //6 la solucion es : 6 // r1 // 6 de multi$licidad 26
8/16/2019 Problema 2.Trabajo 2
4/5
Alumno: Miguel Angel Ruiz YactayoCódigo: 20141147B
else
cout // 6las raices son ima)inarias6 // endl
return 9
<
d) RESULTADOS
%=%>?L@ ?ARA RAB%# R%AL%# % CDAL%#
%=%>?L@ ?ARA RAB%# R%AL%# E FG%R%HI%#
8/16/2019 Problema 2.Trabajo 2
5/5
Alumno: Miguel Angel Ruiz YactayoCódigo: 20141147B
Recommended