W.A.P. to input a number and check whether a number is positive or negative.
Answers
Answered by
2
QUESTION:
- W.A.P. to input a number and check whether a number is positive or negative
SOLUTION:
import java. io. *;
class PositiveNegative
{
public static void main ( int a )
{
if ( a > 0 )
{
System.out.println( a+ " is positive") ;
}
else
{
System.out.println( a+" is negative");
}
}
}
Variable description:
a is the no to check ( int)
Attachments:
Similar questions