Rahul Pandit.
5 Mar 2022
Javascript
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 42 mins ago.
I cannot get two different inputs in the loop, however if at first, I define int n = 1
, it works
import java.util.Scanner;
public class Test
{
public static void main(String[] args)
{
Scanner Input = new Scanner(System.in);
int n = Input.nextInt();
while (n >= 1 && n <=5)
{
if (n == 1)
{
System.out.print("Enter a: ");
String S1 = Input.nextLine();
System.out.print("Enter b: ");
String S2 = Input.nextLine();
System.out.println(S1);
System.out.print(S2);
}
System.out.println();
n = Input.nextInt();
}
Input.close();
}
}
© 2024 Copyrights reserved for web-brackets.com