Computer Science, asked by sunshineanishghosh35, 19 days ago

write a program to enter two digit number and find sum of both the digits

pls genuien answer's only do in java and show

Answers

Answered by I40595567
1

Answer:

java.util.Scanner; public class KboatSpecialNumber { public void checkNumber() { Scanner in = new Scanner(System.in); System.out.print("Enter a 2 digit number: "); int orgNum = in.nextInt(); int num = orgNum; int count = 0, digitSum = 0, digitProduct = 1; while (num != 0) { int digit = num % 10; num /= 10; digitSum += digit; digitProduct *= digit; count++; } if (count != 2) System.out.println("Invalid input, please enter a 2-digit number"); else if ((digitSum + digitProduct) == orgNum) System.out.println("Special 2-digit number"); else System.out.println("Not a special 2-digit number"); } }

Explanation:

from myself

Answered by rehasman
0

Answer:

kya itna burha sum typing karne mein bhoot time lge ga

Similar questions