wadkat

java 2 numbers divide

Nov 2nd, 2018
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. /**MUST System.out.println to define constants at the start or scumbag lecturer marks me down
  2.  
  3. package switchcase;
  4. import java.util.Scanner;
  5. /**
  6. *
  7. * @author pclab
  8. */
  9. public class q4 {
  10. public static void main(String[] args){
  11. Scanner keyboard=new Scanner(System.in);
  12. int no1,no2,result;
  13. System.out.println("Please enter first number");
  14. no1=keyboard.nextInt();
  15. System.out.println("Please enter second number");
  16. no2=keyboard.nextInt();
  17. if (no1>no2)
  18. result=no1%no2;
  19. else if (no2>no1)
  20. result=no2%no1;
  21. else
  22. result=0;
  23. if (result==0)
  24. System.out.println("the 2 numbers are divisible");
  25. else
  26. System.out.println("the 2 numbers are divisible");
  27. }
  28. }
Add Comment
Please, Sign In to add comment