Problem Description
Give you a number on base ten,you should output it on base two.(0 < n < 1000)
Input
For each case there is a postive number n on base ten, end of file.
Output
For each case output a number on base two.
Sample Input
1 2 3
Sample Output
1 10 11import java.util.Scanner; /** * 位集合 * 题目的意思也就是将一个十进制的数转换为二进制然后输出 * @author 逸川同学 * */ public class P2051 { private static Scanner scanner; public static void main(String[] args) { scanner = new Scanner(System.in); while(scanner.hasNext()){ int n = scanner.nextInt(); String string = ""; while(n>0){ string = n%2+string; n = n/2; } System.out.println(string); } } }