1 var 2 a,b,c,D,x1,x2,Re,Im:Real; 3 begin 4 writeln('zadej a,b,c'); 5 readln(a,b,c); 6 D:=(sqr(b))-(4)*(a)*(c); 7 if D>=0 then 8 begin 9 x1:=(-(b)+sqrt(D))/(2*(a)); 10 x2:=(-(b)-sqrt(D))/(2*(a)); 11 writeln('x1:',x1:4:2); 12 writeln('x2:',x2:4:2); 13 end 14 else 15 begin 16 Re:=(-b)/(2*(a)); 17 Im:=sqrt(-D)/(2*(a)); 18 writeln('realna cast:',Re:4:2); 19 writeln('imaginarni cast:',Im:4:2); 20 if Im<0 then begin 21 writeln('x1',Re:4:2,'+i',abs(Im):4:2); 22 writeln('x2',Re:4:2,'-i',abs(Im):4:2); 23 end else begin 24 writeln('x1',Re:4:2,'-i',abs(Im):4:2); 25 writeln('x2',Re:4:2,'+i',abs(Im):4:2); 26 end; 27 28 end; 29 end. 30