pleae solve these two programs of Java
Answers
Question No. 4
public class SmallestNumber {
public static void main ( String[] args ) {
int a = 7, b = 9;
System.out .println( Math.min(a , b);
}
}
*****************************************************************************
Question No. 5
import java.util.Scanner;
public class SumOfDigits {
public static void main ( String[] args ) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int temp = n;
int sum = 0;
int product = 1;
for(int i = 0; i < 2; i++) {
int lastDigit = temp % 10;
temp /= 10;
sum += lastDigit;
product *= lastDigit;
}
int result = sum + product;
if(result == n) {
System.out.println("special 2-digit number");
} else {
System.out.println("Not a special 2-digit number");
}
}
}
**************************************************************************************"