Advertisement
Guest User

Problem 5. Decimal to Hexadecimal

a guest
May 15th, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class DecimalToHexadecimal {
  5.  
  6. public static void main(String[] args) {
  7. Scanner input = new Scanner(System.in);
  8. System.out.print("Enter decimal num: ");
  9. int num = input.nextInt();
  10.  
  11. String hex = Integer.toHexString(num);
  12. System.out.println(hex);
  13. }
  14.  
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement