+ 2
Why it’s not print welcome as much as input taken
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); for(n=0;n<10;n++){ System.out.println("Welcome"); } } }
3 Respuestas
+ 3
You mean input number of to print?
If yes, then it prints 10 times only for what ever input. Because you are replacing n value to 0 in start of loop n=0
Take other variable 'i' and make condition like I<n
for( int i=0; i<n ; i++){
..
}
+ 1
Jayakrishna🇮🇳 Thank You ❤️ I got the output
+ 1
You're welcome..