1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Decimal, Hex, octal and binary number inter conversion

Discussion in 'C' started by shabbir, Oct 5, 2006.

  1. masoudxxx2002

    masoudxxx2002 New Member

    Joined:
    Nov 9, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Thank you very much:crazy:
     
  2. ehsano

    ehsano New Member

    Joined:
    Nov 20, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    thank you mr.shabir you very good:nice::nice::nice:
     
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    The pleasure is all mine
     
  4. seshu

    seshu New Member

    Joined:
    Dec 27, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hii,,
    i need the code for md5 in c language...
    plz help me
     
  5. gatsbycollege

    gatsbycollege New Member

    Joined:
    Dec 27, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Philippines
    hi mr shabbir, got a question here,, can you increase the maximum input of convertion, if i input 32767+ i get wrong convertion thx for the reply
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    Why don't you try the same and share it as an article here. I am sure my code is good enough to explain you the concept.
     
  7. gatsbycollege

    gatsbycollege New Member

    Joined:
    Dec 27, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Philippines
    Code:
    #include <stdio.h>
    #include <conio.h>
    main ()
    {
        int n,r[10],i;
        clrscr();
        printf("Enter a number to get its hexadecimal equivalent\n");
        scanf("%d",&n);
        for(i=0;n!=0;i++)
        {
            r[i]=n%16;
            n=n/16;
        }
        i--;
        for(;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");
        getch();
        return 0;
    }
    
    i tried to change some part because all i need is the convertion,, but im getting a problem in trying to input a decimal value which is 32767+ then convert to hex,
     
  8. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    May be because that is the limit of int and see if changing the data type helps.
     
  9. gatsbycollege

    gatsbycollege New Member

    Joined:
    Dec 27, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Philippines
    yes, tried that thing earlier,,it point me out on using double data type, but the problem is that the code use "%" ,, so i tried fmod,, still no luck,
     

Share This Page