Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SoftUni {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.print("Enter your username: ");
- String username = sc.nextLine();
- String check = "";
- String reversed = "";
- char[] try1 = username.toCharArray();
- for (int i = try1.length-1; i>=0; i--) {
- reversed += try1[i];
- }
- while(true){
- System.out.print("Enter your reversed username to comfirm: ");
- check = sc.nextLine();
- if(check.equals(reversed)){
- break;
- }
- }
- System.out.println("User " + username + " logged in.");
- }
- }
Add Comment
Please, Sign In to add comment