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-

2 comments

  1. I really love your write-ups guys continue the good work.
    learn c++

    ReplyDelete
  2. Interesting read, it was so good to read and useful to improve my knowledge as updated one, keep blogging.

    brittanya razavi

    ReplyDelete

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

Most Reading

Labels