Wednesday 27 March 2013

Find the binary value of given decimal value

#include<stdio.h>
#include<conio.h>
void main()
{
    int n,rem=0,j,i=0,dec[20],temp;
    clrscr();
    printf("\n\t\tThe Software creadet by Dixit Panchal\n");
    printf("\t\tEnter Your decimal Value \n\n");
    scanf("%d",&n);
    temp=n;
    while(n>0)
    {
     rem=n%2;
     n/=2;
     dec[i]=rem;
     i++;


    }
    printf("\nYour Decimal number is %d",temp);
    printf("\nAnd binary is ");
    for(j=i-1 ;j>=0;j--)
    {
       printf("%d",dec[j]);
    }

    getch();


}

No comments:

Post a Comment

How to change Background color by selecting color from Listview

activitymain.xml file::> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     xm...