njoy!!




Code:
#include<iostream>
using namespace std;
int main()
{
int n,r[10],i=0,number,j=0;
printf("Enter the decimal number\n");
scanf("%d",&number);



while(number>0)
{
r[i]=number%16;
number=number/16;
i++;
j++;
}
cout<<"The hexa decimal equivalent is  ";
for(i=j-1;i>=0;i--)
{
if(r[i]==10)
printf("A");
else if(r[i]==11)
printf("B");
else if(r[i]==12)
printf("C");
else if(r[i]==13)
printf("D");
else if(r[i]==14)
printf("E");
else if(r[i]==15)
printf("F");
else
printf("%d",r[i]);
}


printf("\n");

system("pause");
}

Last edited by shabbir; 4Jun2011 at 09:47.. Reason: Code blocks