1.WAP IN JAVA TO INPUT A NUMBER AND CHECK WHETHER THE NUMBER IS ODD POSITIVE OR NOT.
import java.util.*;
class Prog
{
public static void main(String args[ ])
{
Scanner ob=new Scanner(System.in);
int num;
System.out.print(“Enter the number”);
num=ob.nextInt();
if((num>0)&&((num%2)!=0)))
System.out.println(num+”is Odd Positive”);
else
System.out.println(num+”is not Odd Positive”);
}
}
No comments:
Post a Comment