fork download
  1. #include <string>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string str1,str6;
  8. string str2( "Fizz" );
  9. string str3( "Buzz" );
  10. string str4( "Seven" );
  11. string str5( "Eleven" );
  12. int a=3, b=5, c=7, d=11;
  13. for( int i=1; i<101; i++)
  14. {
  15. if(i==a && i==b)
  16. {
  17. if(i==c && i==d)
  18. {
  19. str6 = str2+str3+str4+str5;
  20. a+=3, b+=5, c+=7, d+=11;
  21. }
  22. else if(i==c)
  23. {
  24. str6 = str2+str3+str4;
  25. a+=3, b+=5, c+=7;
  26.  
  27. }
  28. else if(i==d)
  29. {
  30. str6 = str2+str3+str5;
  31. a+=3, b+=5, d+=11;
  32. }
  33. else
  34. {
  35. str6 = str2+str3;
  36. a+=3, b+=5;
  37. }
  38. }
  39. else if(i==a && i==c)
  40. {
  41. if(i==b && i==d)
  42. {
  43. str6 = str2+str3+str4+str5;
  44. a+=3, b+=5, c+=7, d+=11;
  45. }
  46. else if(i==b)
  47. {
  48. str6 = str2+str3+str4;
  49. a+=3, b+=5, c+=7;
  50. }
  51. else if(i==d)
  52. {
  53. str6 = str2+str4+str5;
  54. a+=3, c+=7, d+=11;
  55. }
  56. else
  57. {
  58. str6 = str2+str4;
  59. a+=3, c+=7;
  60. }
  61. }
  62. else if(i==a && i==d)
  63. {
  64. if(i==b && i==c)
  65. {
  66. str6 = str2+str3+str4+str5;
  67. a+=3, b+=5, c+=7, d+=11;
  68. }
  69. else if(i==b)
  70. {
  71. str6 = str2+str3+str5;
  72. a+=3, b+=5, d+=11;
  73. }
  74. else if(i==c)
  75. {
  76. str6 = str2+str4+str5;
  77. a+=3, c+=7, d+=11;
  78. }
  79. else
  80. {
  81. str6 = str2+str5;
  82. a+=3, d+=11;
  83. }
  84. }
  85. else if(i==b && i==c)
  86. {
  87. if(i==a && i==d)
  88. {
  89. str6 = str2+str3+str4+str5;
  90. a+=3, b+=5, c+=7, d+=11;
  91. }
  92. else if(i==a)
  93. {
  94. str6 = str2+str3+str4;
  95. a+=3, b+=5, c+=7;
  96. }
  97. else if(i==d)
  98. {
  99. str6 = str3+str4+str5;
  100. b+=5, c+=7, d+=11;
  101. }
  102. else
  103. {
  104. str6 = str3+str4;
  105. b+=5, c+=7;
  106. }
  107. }
  108. else if(i==b && i==d)
  109. {
  110. if(i==a && i==c)
  111. {
  112. str6 = str2+str3+str4+str5;
  113. a+=3, b+=5, c+=7, d+=11;
  114. }
  115. else if(i==a)
  116. {
  117. str6 = str2+str3+str5;
  118. a+=3, b+=5, d+=11;
  119. }
  120. else if(i==c)
  121. {
  122. str6 = str3+str4+str5;
  123. b+=5, c+=7, d+=11;
  124. }
  125. else
  126. {
  127. str6 = str3+str5;
  128. b+=5, d+=11;
  129. }
  130. }
  131. else if(i==c && i==d)
  132. {
  133. if(i==a && i==b)
  134. {
  135. str6 = str2+str3+str4+str5;
  136. a+=3, b+=5, c+=7, d+=11;
  137. }
  138. else if(i==a)
  139. {
  140. str6 = str2+str4+str5;
  141. a+=3, c+=7, d+=11;
  142. }
  143. else if(i==b)
  144. {
  145. str6 = str3+str4+str5;
  146. b+=5, c+=7, d+=11;
  147. }
  148. else
  149. {
  150. str6 = str4+str5;
  151. c+=7, d+=11;
  152. }
  153. }
  154. else if(i==a)
  155. {
  156. str6 = str2;
  157. a+=3;
  158. }
  159. else if(i==b)
  160. {
  161. str6 = str3;
  162. b+=5;
  163. }
  164. else if(i==c)
  165. {
  166. str6 = str4;
  167. c+=7;
  168. }
  169. else if(i==d)
  170. {
  171. str6 = str5;
  172. d+=11;
  173. }
  174.  
  175. if(str6.size()==0)
  176. {
  177. cout << i << " " << i << endl;
  178. }
  179. else
  180. {
  181. cout << i << " " << str6 << endl;
  182. }
  183. str6 = str1;
  184. }
  185. return 0;
  186. }
Success #stdin #stdout 0s 3436KB
stdin
Standard input is empty
stdout
1 1
2 2
3 Fizz
4 4
5 Buzz
6 Fizz
7 Seven
8 8
9 Fizz
10 Buzz
11 Eleven
12 Fizz
13 13
14 Seven
15 FizzBuzz
16 16
17 17
18 Fizz
19 19
20 Buzz
21 FizzSeven
22 Eleven
23 23
24 Fizz
25 Buzz
26 26
27 Fizz
28 Seven
29 29
30 FizzBuzz
31 31
32 32
33 FizzEleven
34 34
35 BuzzSeven
36 Fizz
37 37
38 38
39 Fizz
40 Buzz
41 41
42 FizzSeven
43 43
44 Eleven
45 FizzBuzz
46 46
47 47
48 Fizz
49 Seven
50 Buzz
51 Fizz
52 52
53 53
54 Fizz
55 BuzzEleven
56 Seven
57 Fizz
58 58
59 59
60 FizzBuzz
61 61
62 62
63 FizzSeven
64 64
65 Buzz
66 FizzEleven
67 67
68 68
69 Fizz
70 BuzzSeven
71 71
72 Fizz
73 73
74 74
75 FizzBuzz
76 76
77 SevenEleven
78 Fizz
79 79
80 Buzz
81 Fizz
82 82
83 83
84 FizzSeven
85 Buzz
86 86
87 Fizz
88 Eleven
89 89
90 FizzBuzz
91 Seven
92 92
93 Fizz
94 94
95 Buzz
96 Fizz
97 97
98 Seven
99 FizzEleven
100 Buzz