#### decimal to hexadecimal in c

``` #include<stdio.h> #include<conio.h> void main() { int decimalNumber,remainder,count=0; char hexadecimalNumber[100]; printf("Enter the decimal number \n"); scanf("%d",&decimalNumber); for(int i=0;decimalNumber>0;i++) { remainder=decimalNumber%16; if (remainder < 10) { hexadecimalNumber[i] =remainder+48; } else { hexadecimalNumber[i] =remainder+55; } decimalNumber/=16; count++; } printf("Its equivalent hexadecimal number is = "); for(int j=count-1;j>=0;j--) { printf("%c",hexadecimalNumber[j]); } getch(); } ```

#### Output

```Enter the decimal number 15 Its equivalent hexadecimal number is = F ```

#### decimal to hexadecimal in c++

``` #include<iostream> #include<conio.h> using namespace std; void main() { int decimalNumber,remainder,count=0; char hexadecimalNumber[100]; cout<<"Enter the decimal number \n"; cin>>decimalNumber; for(int i=0;decimalNumber>0;i++) { remainder=decimalNumber%16; if (remainder < 10) { hexadecimalNumber[i] =remainder+48; } else { hexadecimalNumber[i] =remainder+55; } decimalNumber/=16; count++; } cout<<"Its equivalent hexadecimal number is = "; for(int j=count-1;j>=0;j--) { cout<<hexadecimalNumber[j]; } getch(); } ```

#### Output

```Enter the decimal number 11 Its equivalent hexadecimal number is = B ```

#### decimal to hexadecimal in c#

``` using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConvertDecimalToHexadecimal { class Program { static void Main(string[] args) { int decimalNumber,remainder,count=0; char[] hexadecimalNumber=new char[100]; Console.WriteLine("Enter the decimal number"); decimalNumber = Convert.ToInt32(Console.ReadLine()); for(int i=0;decimalNumber>0;i++) { remainder=decimalNumber%16; if (remainder < 10) { hexadecimalNumber[i] =(char)(remainder+48); } else { hexadecimalNumber[i] =(char)(remainder+55); } decimalNumber/=16; count++; } Console.Write("Its equivalent hexadecimal number is = "); for(int j=count-1;j>=0;j--) { Console.Write(hexadecimalNumber[j]); } Console.ReadLine(); } } } ```

#### Output

```Enter the decimal number 13 Its equivalent hexadecimal number is = D ```

#### decimal to hexadecimal in java

``` import java.util.*; class examples { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int decimalNumber,remainder,count=0; char[] hexadecimalNumber=new char[100]; System.out.println("Enter the decimal number"); decimalNumber = sc.nextInt(); for(int i=0;decimalNumber>0;i++) { remainder=decimalNumber%16; if (remainder < 10) { hexadecimalNumber[i] =(char)(remainder+48); } else { hexadecimalNumber[i] =(char)(remainder+55); } decimalNumber/=16; count++; } System.out.print("Its equivalent hexadecimal number is = "); for(int j=count-1;j>=0;j--) { System.out.print(hexadecimalNumber[j]); } } } ```

#### Output

```Enter the decimal number 14 Its equivalent hexadecimal number is = E ```

### Write a comment

Name Email Message