Wednesday, February 19, 2014

CONVERTION DECIMAL TO BINARY WITH C LANGUAGE

 #include<stdio.h>
 void main()
 {
 int n,i=0,a[10],j;
 printf("\n Enter decimal value=");
 scanf("%d",&n);

 while(n>0)
 {
            a[i]=n%2;
            i++;
            n=n/2;
 }
 printf("Degital value=");
 for(j=i;j>0;j--)
 {
     printf("\t %d",a[j-1]);
 }
 }

No comments:

Post a Comment