Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double a,b,c,il,dis,d,x1,x2;
- a=Double.parseDouble(t1.getText());
- b=Double.parseDouble(t2.getText());
- c=Double.parseDouble(t3.getText());
- if (a==0)
- {
- if(b==0)
- {
- if(c==0)
- {
- l1.setText("Alles gleich ");
- }else
- {
- l1.setText("Es gibt keine Lösung");
- }
- }else
- {
- il=-c/-b;
- l1.setText("x= "+il);
- }
- }else
- {
- dis=(b*b)-(4*a*c);
- if(dis>0)
- {
- d= Math.sqrt(dis);
- x1=-(b-d)/(2*a);
- x2=-(b+d)/(2*a);
- l1.setText("x1 = "+x1+" x2 = "+x2);
- }else
- {
- if(dis==0)
- {
- il=-b/(2*a);
- l1.setText("x = "+il);
- }else
- {
- l1.setText("Es gibt keine Lösung!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement