Answers for "Write a program to find the numerological value for a given name."

0

Write a program to find the numerological value for a given name.

int arr[][]={{65,1},{66,2},{67,3},{68,4},{69,5},{70,8},{71,3},{72,5},{73,1},{74,1},{75,2},{76,3},{77,4},{78,5},{79,7},{80,8},{81,1},{82,2},{83,3},{84,4},{85,6},{86,6},{87,6},{88,5},{89,1},{90,7}};

	String name=sc.nextLine();
        String pattern="[A-Z]+";
         if(name.matches(pattern)){
            int score=0;
            for(int i=0;i<name.length();i++){
                char ch=name.charAt(i);
                score+=arr[(int)ch -65][1];
            }
            System.out.println("Your numerology no is:"+score);
        }
        else System.out.println("Invalid name");
Posted by: Guest on May-12-2021

Code answers related to "Write a program to find the numerological value for a given name."

Browse Popular Code Answers by Language