You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if(n>=0 && n<=99)
{
for(int i=0;i<=n;i++)
System.out.println(i);
System.out.print("Games End");
}
else
System.out.print("Invalid Input");
}
}
Neha and Nisha are playing a game .Nisha ask Neha to enter the number N from given range of 0 to 99 .Now Nisha need to print the number till N and once it exceed the number from N then Print "Games End".If Neha enter the number less then 0 print Invalid input.
3
+
4
+
Input Format
5
+
6
+
Program should take the input for Number N.
7
+
8
+
Constraints
9
+
10
+
0>=N<100
11
+
12
+
Output Format
13
+
14
+
Print the number till N and if the range of N exceed print "Games End”.If Neha enter the number less then 0 print "Invalid Input".
15
+
16
+
Sample Input 0
17
+
18
+
5
19
+
Sample Output 0
20
+
21
+
0
22
+
1
23
+
2
24
+
3
25
+
4
26
+
5
27
+
Games End
28
+
Sample Input 1
29
+
30
+
-10
31
+
Sample Output 1
32
+
33
+
Invalid Input
34
+
*/
35
+
importjava.io.*;
36
+
importjava.util.*;
37
+
38
+
publicclassSolution {
39
+
40
+
publicstaticvoidmain(String[] args) {
41
+
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
0 commit comments