Computer Science, asked by OpAryaDas, 3 days ago

Write a program and check whether it is two digit number or not​

Answers

Answered by srtruhan
0

Answer: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");

}

Explanation:

Similar questions