Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DecToBin {
- public static void main(String[] args) {
- int decimal = 10;
- StringBuilder sb = new StringBuilder();
- do {
- sb.append(decimal%2);
- decimal = decimal/2;
- }while (decimal >=1);
- System.out.println(sb.toString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement