Advertisement
kocev

DecToBin

Feb 19th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.31 KB | None | 0 0
  1. public class DecToBin {
  2.     public static void main(String[] args) {
  3.         int decimal = 10;
  4.         StringBuilder sb = new StringBuilder();
  5.         do {
  6.             sb.append(decimal%2);
  7.             decimal = decimal/2;
  8.         }while (decimal >=1);
  9.         System.out.println(sb.toString());
  10.  
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement