CODE
import java.util.*;
class Hexadecimal
{
static Scanner sc= new Scanner (System.in);
public static void main(String[] args)
{
String Decimal;
int a,y;
int [] num= new int[2];
{
System.out.print("Enter a integer: ");
Decimal= sc.nextLine();
int x= Integer.parseInt(Decimal);
a=0;
while(x!=0)
{
y=x%16;
x=x/16;
num[a]=y;
a++;
}
a--;
if (x==num[a]+num[a-1])
{
swtich(num[a]+num[a-1]);
{
case 10: //it say tat orphaned case
System.out.print("A");
break;
case 11:
System.out.print("B");
break;
case 12:
System.out.print("C");
break;
case 13:
System.out.print("D");
break;
case 14:
System.out.print("E");
break;
case 15:
System.out.print("F");
}
}
System.out.print("The hexadecimal form is ");
for(;a>=0;a--)
{
System.out.print(num[a]);
}
System.out.println();
}
}
}
wat mean of orphaned case??
n izit the array can add like tat??
thx for helping...