#include <iostream>
             #include <conio>
              void main()
              {
                      int ar[44],n,count,i,j;
                      cout<<"Enter decimal number\t";cin>>n;
                      i=0;
                      while(n>=1)
                      {
                        ar[i]=n%2;
                        n=n/2;
                        i++;
                      }
                       i--;
                      cout<<"Binary conversion is\t";
                        for(j=i;j>=0;j--)
                        {
                         cout<<ar[j]<<" ";
                        }
              getch();}
0 comments:
Post a Comment