answersLogoWhite

0


Best Answer

One way to accomplish this is to allow the printf statement to do the work for you.

Example:

printf("Decimal %d = hex %02x\n", number, number);

Or you could use the windows calculator. Select the Dec radian, type your number in, then select Hex radian.

User Avatar

Wiki User

βˆ™ 14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to convert decimal numberto hexadecimal number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a Program to convert decimal number into hexadecimal no without using function and string?

This is not a question.


Write a C program to convert hexadecimal number into decimal number?

pongada punda vayanungala ..................


Write a program to convert a 2 digit BCD number into hexadecimal number?

Write a program to convert a 2-digit BCD number into hexadecimal


2 Write a program to convert a 2-digit BCD number into hexadecimal?

WRITE A PROGRAM TO CONVERT A 2-DIGIT bcd NUMBER INTO HEXADECIMAL


What is SAP give you the brief solution?

Write a program to convert a 2-digit BCD number into hexadecimal


How do you convert binary to hexadecimal using assembly language?

In order to convert binary to hexadecimal using assembly language, the programmer must possess an understanding on boolean algebra or binary system in other words. A compiler is also needed to complete the program.


How do you write a c program to convert binary to decimal by using while statement?

write a c++ program to convert binary number to decimal number by using while statement


Program to convert hex to decimal in 8085?

jump,b


A c program to convert decimal number to decimal number?

The question asks to do nothing by converting a decimal into itself. Perhaps the question was mistyped. Please restate the question.


What is the C program to convert a decimal number to hexadecimal number?

To input a decimal number and display in hex, something like: char buffer[99]; fgets(buffer, 98, stdin); printf("%x", aoti(buffer)); would be the required core code. Needless to say, there is no error checking, mug trapping, etc. Or if you require the hex in a char[], then replace "printf(" by "sprintf(pointer_to_bufffer,"


Write a program that prints a table of the binary, octal and hexadecimal equivalents of the decimal numbers in the range 1 through 256?

import java.util.Scanner; public class NumberSystem { public void displayConversion() { Scanner input = new Scanner(System.in); System.out.printf("%-20s%-20s%-20s%-20s\n", "Decimal", "Binary", "Octal", "Hexadecimal"); for ( int i = 1; i <= 256; i++ ) { String binary = Integer.toBinaryString(i); String octal = Integer.toOctalString(i); String hexadecimal = Integer.toHexString(i); System.out.format("%-20d%-20s%-20s%-20s\n", i, binary, octal, hexadecimal); } } // returns a string representation of the decimal number in binary public String toBinaryString( int dec ) { String binary = " "; while (dec >= 1 ) { int value = dec % 2; binary = value + binary; dec /= 2; } return binary; } //returns a string representation of the number in octal public String toOctalString( int dec ) { String octal = " "; while ( dec >= 1 ) { int value = dec % 8; octal = value + octal; dec /= 8; } return octal; } public String toHexString( int dec ) { String hexadecimal = " "; while ( dec >= 1 ) { int value = dec % 16; switch (value) { case 10: hexadecimal = "A" + hexadecimal; break; case 11: hexadecimal = "B" + hexadecimal; break; case 12: hexadecimal = "C" + hexadecimal; break; case 13: hexadecimal = "D" + hexadecimal; break; case 14: hexadecimal = "E" + hexadecimal; break; case 15: hexadecimal = "F" + hexadecimal; break; default: hexadecimal = value + hexadecimal; break; } dec /= 16; } return hexadecimal; } public static void main( String args[]) { NumberSystem apps = new NumberSystem(); apps.displayConversion(); } }


WRITE A Program to convert integar to hexadecimal in c language?

Use the %X modifier of printf.Code Example:#include int main(void) { unsigned int iMyNumber = 255; printf("The number %u interpreted as hexadecimal is %X.\n", iMyNumber, iMyNumber); return 0; }