Program For convert a decimal number into hexadecimal no. Gain Infiniti

Program For convert a decimal number into hexadecimal no.



       #include<stdio.h>
       #include<conio.h>
       main()
       {
       clrscr();
       int n,r,a[20],i=0,j;
       printf("ente a number");
       scanf("%d",&n);
       while( n>0)
       {
       r=n%16;
       n=n/16;
       a[i]=r;
       i++;
       }
                i--;
       for(j=i; j>=0; j--)
       {
       if(a[j]<10)
       printf("%d",a[j]);
       else
       printf("%c",a[j]-10+'a');
       }
       getch();
      
       return 0;
     }


0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 

Design By Manish and Ranjan