Following is the code, I have written to get two inputs from user. But when I run the program, It takes only one input and generate other by itself and calculate the wrong v
Try using a Scanner object to read your user's input :
Scanner scanner = new Scanner(System.in); int x = scanner.nextInt();