Computer Science, asked by shanaya163, 1 year ago

write a program to check whether the given number is two digit special number or not in java​

Answers

Answered by jyotisikhadash2
7

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

}

}

Answered by vaishnavi852973
0

this is the Java program for your question

Attachments:
Similar questions