Advertisement
Guest User

Untitled

a guest
Oct 1st, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. import java.util.*;
  2. public class program {
  3.  
  4. public static void main(String[] args) {
  5. // TODO Auto-generated method stub
  6.  
  7. double a,b;
  8.  
  9.  
  10. Scanner scan = new Scanner(System.in);
  11. scan.useLocale(Locale.US);
  12. System.out.print("zadejte cislo a: ");
  13. a = scan.nextDouble();
  14. System.out.print("zadejte cislo b: ");
  15. b = scan.nextDouble();
  16.  
  17. System.out.println("---Vysledky---");
  18.  
  19. if (a==0 && b ==0)
  20. {
  21. System.out.println("Rovnice: "+a+"* x + " + b + " = 0");
  22. System.out.println("ma nekonecne reseni");
  23. }
  24.  
  25. if (a ==0 && b != 0)
  26. {
  27. System.out.println("Rovnice: "+a+"* x + " + b + " = 0");
  28. System.out.println("nema reseni v R");
  29. }
  30.  
  31. if (a != 0 && b ==0)
  32. {
  33. System.out.println("Rovnice: "+a+"* x + " + b + " = 0");
  34. System.out.println("ma reseni");
  35. double x = b/a;
  36. System.out.println("x = " + x);
  37. }
  38.  
  39.  
  40. if ( a != 0 && b != 0)
  41. {
  42. System.out.println("Rovnice: "+a+"* x + " + b + " = 0");
  43. double x = -b/a;
  44. System.out.println("ma reseni x = " + x);
  45. }
  46.  
  47. }
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement