➽ Program:-

#include<stdio.h>

#include<string.h>

int main()

{

      int decimal_number, quotient, rem, i=1, j, temp;

    char hexadecimal_number[100];

    printf("Enter any Decimal Number: ");

    scanf("%d",&decimal_number);

    quotient = decimal_number;

    

    while(quotient != 0)

   {

         temp = quotient % 16;

             

         if(temp < 10)

             temp =temp + 48;

         else

             temp = temp + 55;

             

          hexadecimal_number[i++] = temp;

          quotient = quotient / 16;

    }

      

     printf("Hexadecimal value is ", decimal_number);

      

     for(j = i -1; j> 0 ;j--)

         printf("%c", hexadecimal_number[j]);

     return 0;

}

➽ Output:-

Enter any Decimal Number: 1789
Hexadecimal value is 6FD