Advertisement
nadiahristova

Prob5_DecimalToHexadecimal

Jan 24th, 2015
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Prob5_DecimalToHexadecimal {
  4.     public static void main(String[] args) {
  5.         Scanner input = new Scanner(System.in);
  6.         System.out.print("Please enter a number in a decimal format: ");
  7.         int num = input.nextInt();
  8.         String inHexiForm = Integer.toHexString(num);
  9.         System.out.printf("%d = %s", num, inHexiForm.toUpperCase());
  10.     }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement