Question about Computers & Internet

1 Answer

A c prog to convert decimal to hexadecimal number.

I need a c or c++ programming to convert a decimal number to hexadecimal

Posted by on

1 Answer

  • Level 1:

    An expert who has achieved level 1.

    Corporal:

    An expert that hasĀ over 10 points.

    Problem Solver:

    An expert who has answered 5 questions.

  • Contributor
  • 13 Answers

Sure, here you go:

int main(void) {
int input;
printf("Enter a decimal number: ");
scanf("%d", &input);
printf ("In hexadecimal, that is: %X\n\n", input);
return 0;
}

Posted on Oct 06, 2008

  • Josh Anders
    Josh Anders Oct 06, 2008

    Oh, and add "#include " to the top. The new code should read:



    #include

    int main(void) {
    int input;
    printf("Enter a decimal number: ");
    scanf("%d", &input);
    printf ("In hexadecimal, that is: %X\n\n", input);
    return 0;
    }



×

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

How can i convert decimal to binary number in casio fx 82ms calculator?


This gentleman explains it very well. The trick seems to be to enter the number and then hit the equals sign, and then do the conversion.

Good luck,

Paul


Decimal to Binary and Hexadecimal conversions using casio fx 991MS HYONKOWS

Dec 20, 2016 | Casio Office Equipment & Supplies

1 Answer

Converting from BASE-N to Decimal


If you want to convert from another base to decimal, press MODE 4 to enter the BASE-N mode, select the initial base (binary, octal, or hexadecimal), enter the number, then switch to decimal to see the value in decimal.
If you want to exit the BASE-N mode, press MODE 1 to switch to the computational model or MODE 2 for complex mode.

Oct 04, 2011 | Casio FX-115ES Scientific Calculator

2 Answers

How to get from dec. to binary


If you're already in decimal mode, press SHIFT BIN to switch to binary mode.

To convert a number from decimal to binary, press MODE 4 to switch to BASE-N mode. You'll find yourself in decimal mode. Enter the number to convert, press =, then press SHIFT [BIN] (the log key) and see the number in binary. To convert another number, press SHIFT [DEC] to return to decimal, enter the number, press =, then press SHIFT [BIN]. An analogous process works for hexadecimal and octal as well.

To return to "normal" use, press MODE 1 for COMP mode or MODE 2 for complex mode.

Mar 12, 2011 | Casio FX-115ES Scientific Calculator

1 Answer

How do you convert decimal numbers into binary?


Press MODE 4 to enter the BASE-N mode. Type in the decimal number, then press BIN to convert to binary. Press DEC to switch back to decimal for the next conversion.

You're limited to numbers in the range [-32768...32767] in binary. You can extend the range if you convert to octal or hexadecimal and then mentally convert each digit to three or four bits.

Dec 01, 2010 | Casio FX-115ES Scientific Calculator

1 Answer

I need a new front panel for my Pro-2096 and I also need it programmed to my area


Hi, my name is John. You can look on eBay for panel, here are the steps to program your unit. Press PROG. Select the channel you want to store the frequency, press PROG. use the number pad for the frequency number including ./DELAY for the decimal point, press ENT. Get the frequency,s you need here www.RadioReference.com or www.RadioFreq.com enjoy.....John

Oct 25, 2010 | Radio Shack Pro-2096 Base Scanner

1 Answer

What is the serial number for this model


VX8500 does not have an ESN. The VX8500 has an MEID. The MEID is a 14 digit hexadecimal value with the following format:
The decimal representation is calculated as follows:

a). Separate the 14 digit hexadecimal MEID into two parts:
Part 1 – the first 8 digits representing the manufacturer code (digits RRXXXXXX in
the figure).
Part 2 – the last 6 digits representing the serial number. (digits ZZZZZZ in the figure).

b). Convert the hexadecimal value of each part into the decimal equivalent:
Part 1 – 10 decimal digits zero filled.
Part 2 – 8 decimal digits zero filled.
If the decimal equivalent of each part is less than the number of required digits, right align
and zero fill to create the required length.

c). Concatenate Part 1 and Part 2 to create an 18 digit decimal number.

Example:
Hex MEID = AF 01 23 45 0A BC DE
Part 1, manufacturer code is 0xAF012345 = 2936087365
Part 2, serial number is 0x0ABCDE = 00703710
Therefore, the decimal representation of the MEID is 29360 87365 0070 3710

Sep 10, 2009 | LG CHOCOLATE VX8500 Cellular Phone

1 Answer

Java code for adding octal, hexadecimal subtracting binary,


Hello desireejane,


One method is to do the following

  1. Convert the octal, hexadecimal or binary to decimal.
  2. Add or Subtract the decimal normally
  3. Convert the result back to octal, hexadecimal or binary.

  • Convert the octal to decimal:

public static long octalToDecimal(String octal) throws NumberFormatException {
// Initialize result to 0
long res = 0;

// Do not continue on an empty string
if (octal.isEmpty()) {
throw new NumberFormatException("Empty string is not an octal number");
}

// Consider each digit in the string
for (int i = 0; i < octal.length(); i++) {
// Get the nth char from the right (first = 0)
char n = octal.charAt(octal.length() - (i+1));

int f = (int) n - 48;
// Check if it's a valid bit
if (f < 0 || f > 7) {
// And if not, die horribly
throw new NumberFormatException("Not an octal number");
} else {
// Only add the value if it's a 1
res
+= f*Math.round(Math.pow(2.0, (3*i)));
}
}

return res;
}



Mar 24, 2009 | Sun Java Programming Language (cdj-275)

1 Answer

Programming in c


To convert numbers you can use the printf() function
printf("%d", x'FF') hex to decimal
printf("%o", x'FF') hex to octal

If you want to save the value in another variables use sprintf
e.g

a = x'FF';
b = sprintf("%d",a)


Jan 15, 2009 | Computers & Internet

1 Answer

C++ program for the conversion of decimal numbers to hexadecimal


all your solution is at
http://www.c.happycodings.com/Beginners_Lab_Assignments/code18.html

Dec 07, 2008 | Computers & Internet

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

104 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Les Dickinson
Les Dickinson

Level 3 Expert

18384 Answers

kakima

Level 3 Expert

102366 Answers

David Payne
David Payne

Level 3 Expert

14161 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...