write a program to check whether the given number is two digit special number or not in java
Answers
Special two digit number. A special two-digit number is a number such that when the sum of the digits of the number is added to the product of its digits, the result is equal to the original two-digit number.
Example- 59,29 etc
HERE IS YOUR PROGRAM~~~
//special_two_digit
import java.io.*;
class computer
{
public static void main(String
args[])throws IOException
{
int n;
System.out.println("Enter a
number");
n=Integer.parseInt(br.readLine());
int m=n,d,p=1,s=0;
while(m>0)
{
d=m%10;
s=s+d;
p=p*d;
m=m/10;
}
if(s+p==n)
System.out.println("Special two
digit number");
else
System.out.println("Not Special
two digit number");
}
}
this is the Java program for your question