Write a Java Program to input two digit number if it is a two digit number then display the sum of its digits otherwise display the message The number is not a two digit number.
Write in Java.lang
Please write the program and send.
If you will help me I will mark you as brainlist.
Answers
Answered by
0
Answer:
its very tough to type I will attach file later
Answered by
0
import java.util.Scanner;
class digits
{
public static void main()
{
System.out.println("Enter a number: ")
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
this program takes number input from user because i dont have time for these silly questions i will only tell you the process to extract digit from it then u can add them.
to extract digit of its tenth digit of two digit number divide it by 10 and convert the quotient to integer then to get the next digit again divide the number by 10 and convert its remainder to integer then add the both.
and to check wether the input no. is two digit or not you can use if else.
Similar questions
Social Sciences,
3 months ago
Math,
3 months ago
Math,
7 months ago
Math,
7 months ago
Hindi,
11 months ago
India Languages,
11 months ago