ec.cuad <- function(a,b,c) { disc <- b^2-4*a*c if (disc < 0) {print("No existen soluciones reales")} else { if (disc == 0) { x <- -b/(2*a) print(paste("Unica solucion real x=", as.character(round(x,2)))) } else { x1 <- (-b-sqrt(disc))/(2*a) x2 <- (-b+sqrt(disc))/(2*a) print(paste("Dos soluciones reales: x1=", as.character(round(x1,2)), " y x2=",as.character(round(x2,2)))) } } }