Write a program (WAP) in java to accept a positive whole number from the user and check
whether it is as special two-digit number or not.
Answers
Answered by
24
Here is your answer.
import java.util.*;
class x
{
static void main()
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter a two-digit number: ");
int a=sc.nextInt();
int f=a/10,e=a%10;
int s=f+e;
int p=f*e;
if(s+p==a)
System.out.println("It is a two digit special number.");
else
System.out.println("It is not a two digit special number.");
}
}
Similar questions