English, asked by Vishal3628, 1 day ago

write a program to input a number and find out if it is single digit or double digit number display the output with proper message.​

Answers

Answered by twakhiahamed0805
12

Explanation:

ANSWER

import java.util.Scanner;

public class KboatFactors

{

public void fact(int n) {

if (n < 10 || n > 99) {

System.out.println("ERROR!!! Not a 2-digit number");

return;

}

int i;

for (i = 2; i <= n; i++) {

if (n % i == 0)

break;

}

int sf = n / i;

System.out.println(i + ", " + sf);

}

public static void main(String args[]) {

Scanner in = new Scanner(System.in);

System.out.print("Enter number: ");

int num = in.nextInt();

KboatFactors obj = new KboatFactors();

obj.fact(num);

}

}

Similar questions