7 Respuestas
+ 4
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner sc=new Scanner (System.in) ;
System. out. println ("enter any age");
int age;
age=sc.nextInt();
if(age <= 0) {
System.out.println("Error");
} else if(age <= 16) {
System.out.println("Too Young");
} else if(age < 100) {
System.out.println("Welcome!");
} else {
System.out.println("Really?");
}
}
}
+ 3
import java.util.Scanner;
class Program {
public static void main(String[] args) {
Scanner sc=new Scanner (System.in);
System.out.println("enter any no");
int a;
a=sc.nextInt();
if (a>20){
System.out.println ("adult");
}else{
System.out.println ("too young");
}
}
}
+ 3
considerations: the code marked error due to the spaces you made in each word of each line. For example:
incorrect:
import java. util. Scanner ;
correct:
import java.util.Scanner;
+ 2
correct :
Scanner sc=new Scanner (System.in);
+ 2
Without SPACE bro
0
Its not working
0
I have written same