WAP for generating a new number using hthe unit digits.Take two numbers as input then generate a highest possible number using the unit digits of those two numbers
Answers
Answered by
2
import java.util.*;
class nitin
{
pubic static void main(String args[])
{
Scanner in=new Scanner(System.in);
System.out.println("enter 2 numbers");
int a=in.nextInt();
int b=in.nextInt();
int max=0;
if (a%10>=b%10)
max=((a%10)*(10))+(b%10);
else
max=((b%10)*(10))+(b%10);
System.out.println(max);
}
}
class nitin
{
pubic static void main(String args[])
{
Scanner in=new Scanner(System.in);
System.out.println("enter 2 numbers");
int a=in.nextInt();
int b=in.nextInt();
int max=0;
if (a%10>=b%10)
max=((a%10)*(10))+(b%10);
else
max=((b%10)*(10))+(b%10);
System.out.println(max);
}
}
Similar questions