write a program to check odd or even
Answers
Answered by
1
import java.util.Scanner;
public class Num4
{
void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter a no.");
int a =sc.nextInt();
if (a%2==0)
System.out.println("even");
else
System.out.println("odd");
}
}
nitish8089:
error in your program edit it..
Answered by
0
import java.util.Scanner;
public class Program{
public static void main(String...args){
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
if(a%2==0){
System. out.println(a+" is an even number ");
}
else{
System. out.println(a+" is odd number ");
}
}
}
public class Program{
public static void main(String...args){
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
if(a%2==0){
System. out.println(a+" is an even number ");
}
else{
System. out.println(a+" is odd number ");
}
}
}
Similar questions