We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de40022 commit a83796dCopy full SHA for a83796d
problem4.c
@@ -0,0 +1,32 @@
1
+//Solution by Pavithra B, 111712205071, IT dept.
2
+
3
+#include<stdio.h>
4
+int main(){
5
+ long int decimalNumber,remainder,quotient;
6
+ int i=1,j,temp;
7
+ char hexadecimalNumber[100];
8
9
+ printf("Enter any decimal number: ");
10
+ scanf("%ld",&decimalNumber);
11
12
+ quotient = decimalNumber;
13
14
+ while(quotient!=0){
15
+ temp = quotient % 16;
16
17
+ //To convert integer into character
18
+ if( temp < 10)
19
+ temp =temp + 48;
20
+ else
21
+ temp = temp + 55;
22
23
+ hexadecimalNumber[i++]= temp;
24
+ quotient = quotient / 16;
25
+ }
26
27
+ printf("Equivalent hexadecimal value of decimal number %d: ",decimalNumber);
28
+ for(j = i -1 ;j> 0;j--)
29
+ printf("%c",hexadecimalNumber[j]);
30
31
+ return 0;
32
+}
0 commit comments