Advertisement
Guest User

Untitled

a guest
May 20th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. package JavaRabbil;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class LargestNum {
  6.  
  7. public static void main(String args[]){
  8.  
  9.  
  10. int a,b,c;
  11. Scanner sc = new Scanner(System.in);
  12. System.out.println("Enter input A");
  13. a = sc.nextInt();
  14. System.out.println("Enter input B");
  15. b = sc.nextInt();
  16. System.out.println("Enter input C");
  17. c = sc.nextInt();
  18.  
  19. if (a>b && a>c){
  20. System.out.println("A is largest : "+a);
  21. }
  22.  
  23.  
  24. else if (b>a && b>c){
  25. System.out.println("B is largest : "+b);
  26. }
  27.  
  28.  
  29. else if (c>a && c>b){
  30. System.out.println("C is largest : "+c);
  31. }
  32.  
  33.  
  34. else if (a==b && b==c && c==a){
  35. System.out.printf("a-%d , b-%d , c-%d = same input here ",a,b,c);
  36. }
  37.  
  38. else{
  39. System.out.println("wrong Input");
  40. }
  41.  
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement