(java program) How do you input a number and check if it is a positive 5-digit number or not
Answers
Answered by
4
Step-by-step explanation:
import java.util.*;
class FiveDigNum
{
public static void main(String args[])
{
Scanner sc=new Scanner (System.in);
int n;
System.out.println("enter a number");
n=sc.nextInt();
if(n/10000>0)
System.out.println("a 5digitpositivenumber");
else
System.out.println("not a5digitnumber");
}
}
Attachments:
Anonymous:
Awesome
Similar questions
English,
5 months ago
Science,
5 months ago
Science,
9 months ago
Math,
9 months ago
Social Sciences,
1 year ago