Decimal to Binary Conversion C Program

Saturday, 7 January 2017


   #include<stdio.h>
   #include<conio.h>
   void main()
   {
   int a[10],n,i;
   clrscr();
   printf("Enter no.\n");
   scanf("%d",&n);
   for(i=0;n>0;i++)
   {
   a[i]=n%2;
   n=n/2;

   }
   printf("Binary:\n");

   for(i=i-1;i>=0;i--)
   {
   printf("%d",a[i]);
   }
   getch();
   }

OUTPUT-

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
Related Posts Plugin for WordPress, Blogger...
 

Most Reading

Labels