Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final Map<Character,Integer> map=new HashMap<Character,Integer>();
- final Scanner scanner=new Scanner(System.in);
- for(char c='a';c<='c';c++)
- {
- System.out.println("Podaj "+c);
- map.put(c,scanner.nextInt());
- }
- map.put('d',map.get('b')*map.get('b')-4*map.get('a')*map.get('c'));
- System.out.println("a="+map.get('a')+"\nb="+map.get('b')+"\nc="+map.get('c')+"\ndelta="+map.get('d'));
- if(map.get('d')>0)
- System.out.println("x1="+(-map.get('b')-Math.sqrt(map.get('d')))/(2*map.get('a'))+" x2="+(-map.get('b')+Math.sqrt(map.get('d')))/(2*map.get('a')));
- else if(map.get('d')==0)
- System.out.println("x="+(-map.get('b'))/(2*map.get('a')));
- else
- System.out.println("brak rozwiazan");
- scanner.close();
- System.exit(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement