Advertisement
Guest User

druhy

a guest
Feb 25th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <math.h>
  4.  
  5. int program(int x)
  6. {
  7. int a;
  8. int zvysok;
  9. scanf("%d", &x);
  10. if (x == 100)
  11. {
  12. printf("C\n");
  13. return 0;
  14. }
  15. zvysok = x % 10;
  16. a = (x - zvysok) / 10;
  17. if (a == 9)
  18. {
  19. printf("XC");
  20. }
  21. else if (a > 4) {
  22. printf("L");
  23. }
  24. if (a > 4)
  25. {
  26. a = a - 5;
  27. }
  28.  
  29. if (a == 4)
  30. {
  31. if (x > 89)
  32. {
  33. x = x;
  34. }
  35. else {
  36. printf("XL");
  37. }
  38. }
  39. else
  40. {
  41. for (int i = 0; i < a; i = i + 1)
  42. {
  43. printf("X");
  44. }
  45. }
  46. zvysok = x % 5;
  47. if (x % 10 >=5)
  48. {
  49. if (x % 10 == 9)
  50. {
  51. printf("IX");
  52. }
  53. else {
  54.  
  55. printf("V");
  56. }
  57. }
  58. else if (x%10 == 4)
  59. {
  60. printf("IV");
  61. }
  62. if ( x%5 !=4)
  63. {
  64. for (int i = 0; i < zvysok; i = i + 1)
  65. {
  66. printf("I");
  67. }
  68. }
  69. printf("\n");
  70. return 0;
  71. }
  72.  
  73. int main()
  74. {
  75. for (int cis = 0; cis < 101; cis = cis + 1) {
  76. program(cis);
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement