Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class week8 {
  4.  
  5.  
  6. public static void main(String[] args) {
  7. //Inputs
  8. Scanner input = new Scanner(System.in);
  9. System.out.println("Input security code");
  10. int S = input.nextInt(); //S=Security Code
  11. int H=1;
  12.  
  13. //Process
  14.  
  15. int [][] C = { //C=Account Numbers and Security Codes
  16. {786411, 54},
  17. {552909, 932},
  18. {641608, 1408}
  19. };
  20.  
  21. for (int row=0; row < C.length; row++)
  22. {
  23. if (S - (C[row][1]) <= 10 && S - (C[row][1]) >= -10)
  24. {
  25. H = 2;
  26. System.out.println("The account number is " + C[row][0]);
  27. break;
  28. }
  29.  
  30. }
  31.  
  32. if (H<2) System.out.println("The Code can be used");
  33.  
  34.  
  35.  
  36.  
  37. }
  38.  
  39.  
  40.  
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement