Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- byte liczba = sc.nextByte();
- int najwiekszaPotega = 3;
- for(; najwiekszaPotega >= 0; najwiekszaPotega--){
- int liczbaDoOdjecia = 1 << najwiekszaPotega;
- if(liczbaDoOdjecia <= liczba){
- liczba -= liczbaDoOdjecia;
- System.out.println(liczbaDoOdjecia);
- }
- else
- System.out.println(0);
- }
- sc.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement