Thank you all for being with us.
Learn, Create and Implement.

  • Build Concept

    You can build your concept in programming on programsway.com.

  • Examples

    There are many C Programming examples on programsway.com.

  • Ask Questions

    Ask questions and get quick answers. Request any program and we will publish that program.

  • Friday, 17 May 2013


    This is a program to convert binary to decimal
    /* author- WYES KARNY */
    #include<stdio.h>
    int main()
    {
      int a,rem,des=0,i=1;
    printf("Enter a binary number ");
    scanf("%d",&a);
    while(1)
    {
    rem=a%10;
    a=a/10;
    des+=rem*i;
    i=i*2;
    if(a==0)
    break;
    }
    printf("\nThe equevalent desimal value is %d \n",des);
    return 0;
    }

    And for the Decimal to binary
    #include<stdio.h>
    int main()
    {
    int a,i,shift,bit;
    scanf("%d",&a);
    for(i=0;i<16;i++)
    {
    shift=a<<i;
    shift=shift>>15;
    bit=shift&1;
    if(bit==1)
    printf("1");
    else
    printf("0");
    }
    }

    0 comments:

    Post a Comment