Write a program in java in which will except any floating number and display any floating positive or negative number
Answers
Answered by
1
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
float a=sc.nextFloat();
// enter the value:
if(a>0){
System.out.println(a+" is a positive number");
}
else if(a<0){
System.out.println(a+" is a negative number");
}
else{
System.out.println(a+" you entered is a zero");
}
}
}
Similar questions