Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Assign2 {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String x = sc.next();
- int res1 = AnaLR(x);
- int res2 = AnaRL(x);
- int sum = res1+res2;
- System.out.println(sum);
- boolean bool = Div10(sum);
- if(bool)
- System.out.println("Credit Card " + x + " " + " is valid ");
- else
- System.out.println("Credit Card " + x + " " + " is not valid ");
- }
- public static int AnaRL(String x){
- for( x = 1; x <= 9; x++) {
- if(x % 2 != 0)
- res2 = res2 + x;
- return res2;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement