#include // Struktur zur Abbildung von arabisch → römisch typedef struct { int wert; const char *zeichen; } Roemisch; // Tabelle in absteigender Reihenfolge Roemisch roemischTabelle[] = { {1000, "M"}, {900, "CM"}, {500, "D"}, {400, "CD"}, {100, "C"}, {90, "XC"}, {50, "L"}, {40, "XL"}, {10, "X"}, {9, "IX"}, {5, "V"}, {4, "IV"}, {1, "I"} }; // Hauptfunktion int main() { int zahl; printf("Zu wandelnde Zahl: "); scanf("%d", &zahl); if (zahl <= 0 || zahl > 3999) { printf("Nur Zahlen zwischen 1 und 3999 erlaubt!\n"); return 1; } printf("... %d = ", zahl); for (int i = 0; i < sizeof(roemischTabelle) / sizeof(Roemisch); i++) { while (zahl >= roemischTabelle[i].wert) { printf("%s", roemischTabelle[i].zeichen); zahl -= roemischTabelle[i].wert; } } printf("\n"); return 0; }