|
Newbie Member
|
|
|
13Jun2012,13:28
|
|
|
|
- //Decimal to Hex value
- main()
- {
- char hex[16]={"0123456789ABCDEF"};
- int num,i=0,j;
- char result[];
- printf("Enter the Decimal No.\n");
- scanf("%d",&num);
- while(num)
- {
- result[i]=hex[num%16];
- num=num=num/16;
- i++;
- }
- printf("Given num of the hex value is:");
- for(j=i-1;j>=0;j--)
- printf("%c",result[j]);
- getch();
- return 0;
- }
|