Advertisement
Guest User

Untitled

a guest
Nov 8th, 2020
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Assign2 {
  3. public static void main(String[] args) {
  4. Scanner sc = new Scanner(System.in);
  5. String x = sc.next();
  6. int res1 = AnaLR(x);
  7. int res2 = AnaRL(x);
  8. int sum = res1+res2;
  9. System.out.println(sum);
  10. boolean bool = Div10(sum);
  11. if(bool)
  12. System.out.println("Credit Card  " + x + "  " + " is valid ");
  13. else
  14. System.out.println("Credit Card  " + x + "  " + " is  not valid ");
  15. }
  16.  
  17. public static int AnaRL(String x){
  18.  
  19.     for( x = 1; x <= 9; x++) {
  20.         if(x % 2 != 0)
  21.             res2 = res2 + x;
  22.         return res2;
  23.     }
  24.            
  25.        
  26. }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement