Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class program {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- double a,b;
- Scanner scan = new Scanner(System.in);
- scan.useLocale(Locale.US);
- System.out.print("zadejte cislo a: ");
- a = scan.nextDouble();
- System.out.print("zadejte cislo b: ");
- b = scan.nextDouble();
- System.out.println("---Vysledky---");
- if (a==0 && b ==0)
- {
- System.out.println("Rovnice: "+a+"* x + " + b + " = 0");
- System.out.println("ma nekonecne reseni");
- }
- if (a ==0 && b != 0)
- {
- System.out.println("Rovnice: "+a+"* x + " + b + " = 0");
- System.out.println("nema reseni v R");
- }
- if (a != 0 && b ==0)
- {
- System.out.println("Rovnice: "+a+"* x + " + b + " = 0");
- System.out.println("ma reseni");
- double x = b/a;
- System.out.println("x = " + x);
- }
- if ( a != 0 && b != 0)
- {
- System.out.println("Rovnice: "+a+"* x + " + b + " = 0");
- double x = -b/a;
- System.out.println("ma reseni x = " + x);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement