2. Write a program to input two numbers and print their sum. Also
print whether their sum is a single digit or a double digit or more
than a double-digit number.
Answers
Answered by
0
Answer:
import java.util.*;
public class Question {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Input Any 2 Numbers");
int a = sc.nextInt();
int b = sc.nextInt();
int c = a+b;
System.out.println("Sum = "+c);
if (c <= 9) {
System.out.println("The Sum Is A Single Digit Number");
}
else if (c<=99 && c>9) {
System.out.println("The Sum Is A Double Digit Number");
}
else {
System.out.println("It is more than a double - digit number");
}
Similar questions