Last active
October 20, 2018 12:33
-
-
Save theArjun/d3eef76782ec2a069f713d4558089c23 to your computer and use it in GitHub Desktop.
Decimal Number To Binary Number System
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DecToBin{ | |
| public static void main(String[] args){ | |
| int dec = 64; | |
| int bin=1,rem=0;// I assigned bin to 1 in this revision. | |
| while(dec>1){ // I run the loop while dec is greater than 1 in this revision. | |
| rem=dec%2; | |
| bin=bin*10+rem; | |
| dec=dec/2; | |
| } | |
| System.out.println("In Binary = "+bin); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment