Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <math.h>
- int program(int x)
- {
- int a;
- int zvysok;
- scanf("%d", &x);
- if (x == 100)
- {
- printf("C\n");
- return 0;
- }
- zvysok = x % 10;
- a = (x - zvysok) / 10;
- if (a == 9)
- {
- printf("XC");
- }
- else if (a > 4) {
- printf("L");
- }
- if (a > 4)
- {
- a = a - 5;
- }
- if (a == 4)
- {
- if (x > 89)
- {
- x = x;
- }
- else {
- printf("XL");
- }
- }
- else
- {
- for (int i = 0; i < a; i = i + 1)
- {
- printf("X");
- }
- }
- zvysok = x % 5;
- if (x % 10 >=5)
- {
- if (x % 10 == 9)
- {
- printf("IX");
- }
- else {
- printf("V");
- }
- }
- else if (x%10 == 4)
- {
- printf("IV");
- }
- if ( x%5 !=4)
- {
- for (int i = 0; i < zvysok; i = i + 1)
- {
- printf("I");
- }
- }
- printf("\n");
- return 0;
- }
- int main()
- {
- for (int cis = 0; cis < 101; cis = cis + 1) {
- program(cis);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement