OOP Programs
Friday, March 16, 2012
Decimal to Binary conversion...
#include<iostream.h>
#include<conio.h>
void main ()
{
int num,c=-1,arr[1000],n;
cout<<"Enter the number :";
cin>>num;
for(int i=num;i>0;i=i/2)
{c++;
arr[c]=i%2;
n=c;
}
for(c=n;c>=0;c--)
cout<<arr[c];
getch();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment