Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int broj = 0;
- cout << "Unesite broj u intervalu 1-500: ";
- cin >> broj;
- do
- {
- if (broj <1 || broj >500) cout << "Niste unijeli broj u intervalu 1-500.\n";
- else
- {
- if (broj == 500) { cout << "D"; broj -= 500; }
- if (broj >= 400) { cout << "CD"; broj -= 400; }
- if (broj >= 300) { cout << "CCC"; broj -= 300; }
- if (broj >= 200) { cout << "CC"; broj -= 200; }
- if (broj >= 100) { cout << "C"; broj -= 100; }
- if (broj >= 90) { cout << "XC"; broj -= 90; }
- if (broj >= 80) { cout << "LXXX"; broj -= 80; }
- if (broj >= 70) { cout << "LXX"; broj -= 70; }
- if (broj >= 60) { cout << "LX"; broj -= 60; }
- if (broj >= 50) { cout << "L"; broj -= 50; }
- if (broj >= 40) { cout << "XL"; broj -= 40; }
- if (broj >= 30) { cout << "XXX"; broj -= 30; }
- if (broj >= 20) { cout << "XX"; broj -= 20; }
- if (broj >= 10) { cout << "X"; broj -= 10; }
- if (broj >= 9) { cout << "IX"; broj -= 9; }
- if (broj >= 8) { cout << "VIII"; broj -= 8; }
- if (broj >= 7) { cout << "VII"; broj -= 7; }
- if (broj >= 6) { cout << "VI"; broj -= 6; }
- if (broj >= 5) { cout << "V"; broj -= 5; }
- if (broj >= 4) { cout << "IV"; broj -= 4; }
- if (broj >= 3) { cout << "III"; broj -= 3; }
- if (broj >= 2) { cout << "II"; broj -= 2; }
- if (broj >= 1) { cout << "I"; broj -= 1; }
- }
- cout << "\n\nUnesite broj u intervalu 1-500: ";
- cin >> broj;
- } while (broj>0);
- system("pause > nul");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment