- 3
Can someone help me ?
9 Answers
+ 4
Use
import java.util.Scanner;
and that's
nextInt()
not
nextint();
use == not =
+ 2
import java.util.Scanner ;
//Import Scanner class
public class Program
{
public static void main(String[] args) {
System.out.println("Enter element");
Scanner ref=new Scanner(System.in);
int a=ref.nextInt();
//Use capital I
if(a%2==0)//Use equality operator instead of assingnment operator
{
System.out.println("eve");
}
else{
System.out.println("odd");
}
}}
+ 1
Thank you HrCoder, Atul
+ 1
I didn't not how is this done đ
try to input value many times it will work
+ 1
At first it showed no output for me too. But after that it showed the correct output
0
HrCoder nextLine is for strings
0
Atul [Inactive] that was mistakenly written sorry
Because of Auto Check on my keyboard
0
HrCoder No problem
0
Atul [Inactive]
Its showing no output why?
import java.util.Scanner ;
public class Program
{
public static void main(String[] args) {
System.out.println("Enter element");
Scanner ref=new Scanner(System.in);
int a=ref.nextInt();
if(a%2==0){
System.out.println("eve");
}
else{
System.out.println("odd");
}
}}