**Ans.**

**Algorithm:**
Step 1: Input NUM

Step 2: LEN = 0 & Y=NUM

Step 3: While (Y > 0)

HEXD[LEN]=Y%16

Y=Y/16

LEN++

Step 4: for(I=LEN-1;I>-1;I–)

IF(HEXD[I]<10)

HEXC[I]=HEXD[I]+48;

ELSE

HEXC[I]=HEXD[I]+55;

Step 5: HEXC[I]=NULL

Step 5: Print HEXC

**Program:**

#include<stdio.h>

#include<math.h>

#include<conio.h>

int main()

{

int
decimal_number, remainder, hexadecimal_number = 0;

int
count = 0;

scanf("Enter
a Decimal Number:\t");

scanf("%d",
&decimal_number);

while(decimal_number
!= 0)

{

remainder
= decimal_number % 16;

hexadecimal_number
= hexadecimal_number + remainder * pow(10, count);

decimal_number
= decimal_number / 16;

count++;

}

scanf("\nHexadecimal
Equivalent:\t%d\n", hexadecimal_number);

return
0;

getch();

}

## 0 comments:

## Post a Comment

Let us know your responses and feedback