Rahul Pandit.
Published in : 2022-03-05

I cannot get two different input in the loop, howerver if at first I define int n = 1, it works [closed]

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.

Improve this question

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(); }}

Comments

Shilpa Date : 2022-03-05

Best answers

10

Best answers

10

The default value of int is 0.

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

Vanilla JavaScript Next & prev Navigation
Publish date: 2022-02-22 | Comments: 1

Tag: Javascript

How select specific tag in jQuery using if else statement?
Publish date: 2022-02-27 | Comments: 1

Tag: Javascript

Help: How do I loop simple JSON objects to iterate all keys and values itself?
Publish date: 2022-03-06 | Comments: 1

Tag: Javascript

Check if div have touch another div
Publish date: 2022-03-02 | Comments: 1

Tag: Javascript

Can I read a local json, image or text file from Javascript?
Publish date: 2022-03-03 | Comments: 1

Tag: Javascript

How to get audio input and audio output as one stream?
Publish date: 2022-02-13 | Comments: 2

Tag: Javascript

Coping plain text into form bug.
Publish date: 2022-02-11 | Comments: 1

Tag: Javascript