16 Blue Bridge Cup Foundation-decimal to hexadecimal
Source: Internet
Author: User
Import Java.util.Scanner;
/* Decimal Turn hex
Problem description
The hexadecimal number is a representation of an integer that is often used in programming. It has
0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f a total of 16 symbols, representing 0 to 15 of the decimal number, respectively. The hexadecimal Count party
The method is 16 in 1, so the decimal number 16 in hexadecimal is 10, while the decimal 17 in hexadecimal is 11, and so on,
The decimal 30 in hexadecimal is 1 E.
A nonnegative integer is given, which is represented as a 16-binary form.
Input format
The input contains a non-negative integer A that represents the number to convert. 0<=a<=2147483647
Output format
Output 16 binary representation of this integer
Sample input
30
Sample output
1e*/
public class Decimal_hexadecimal
{
public static void Main (string[] args)
{
Scanner s = new Scanner (system.in);
int a = S.nextint ();
if (a>=0 && a<=2147483647)
{
Convert decimal to hexadecimal
System.out.println (Integer.tohexstring (a));
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.