The program convert decimal numbers to binary [C++]
This program can convert from decimal number to binary number by using C++ Language. this is the code :
#include<iostream.h>
#include<conio.h>
#include<windows.h>
void main()
{ ulang:
int i=0,k,biner[100];
int desimal;
char pil;
cout<<" ==Program untuk mencari Bilangan biner==";
cout<<"\n\nMasukan Bilangan desimal yang ingin dikonversikan ke biner : ";
cin>>desimal;
for(i=0;i<100;i++)
{
biner[i]=desimal%2;
desimal=desimal/2;
if(desimal==0)
{
break;
}
}
k=i;
cout<<"\n\n\n";
for(i=k;i>=0;i--)
{
cout<<biner[i];
}
cout<<"\n\nMau Coba lagi y/n : ";
cin>>pil;
if(pil=='y')
{
system("cls");
goto ulang;
}
else
{
getch();
}
}
Subscribe to:
Post Comments (Atom)
ABOUT ME
Albert Julius. Powered by Blogger.
0 comments:
Post a Comment