22.5.2
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void dualwand(unsigned int zahl){ //unsigned für zweierkomplement
|
||||||
|
if(zahl != 0){ //Abbruchbedingung
|
||||||
|
dualwand(zahl/2); //Rekursion
|
||||||
|
printf("%d", zahl%2); //Gibt die Bits aus
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int eingabe = 0;
|
||||||
|
|
||||||
|
printf("Gib eine Dezimalzahl ein:");
|
||||||
|
scanf("%d", &eingabe); //Eingabe von Dezimalzahl
|
||||||
|
|
||||||
|
dualwand(eingabe);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user