lst-0056-godb.cpp
//#(compile) c++; compiler:g132; options:-O3 -std=c++23; libs:-
// https://godbolt.org/z/nMcsbxvvv
#include <iostream>
void printBin(int x) {
while(x>0) { // fertig?
int a = x/2; // Division durch 2
int b = x%2; // Modulo, Rest der Division
std::cout << x <<" / 2 = " << a << ", Rest " << b<<'\n'; // Ausgabe
x = a;
}
}
int main() {
printBin(412);
}