22.5.2
This commit is contained in:
parent
6095c6fdf3
commit
c2772032d7
17
dualwand.c
Normal file
17
dualwand.c
Normal file
@ -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);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user