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
  23. {
  24. str6 = str2+str3;
  25. a+=3, b+=5;
  26. }
  27. }
  28. else if(i==a)
  29. {
  30. if(i==c && i==d)
  31. {
  32. str6 = str2+str4+str5;
  33. a+=3, c+=7, d+=11;
  34. }
  35. else if(i==c)
  36. {
  37. str6 = str2+str4;
  38. a+=3, c+=7;
  39. }
  40. else if(i==d)
  41. {
  42. str6 = str2+str5;
  43. a+=3, d+=11;
  44. }
  45. else
  46. {
  47. str6 = str2;
  48. a+=3;
  49. }
  50. }
  51. else if(i==b)
  52. {
  53. if(i==c && i==d)
  54. {
  55. str6 = str3+str4+str5;
  56. b+=5, c+=7, d+=11;
  57. }
  58. else if(i==d)
  59. {
  60. str6 = str3+str5;
  61. b+=5, d+=11;
  62. }
  63. else
  64. {
  65. str6 = str3;
  66. b+=5;
  67. }
  68. }
  69. else if(i==c)
  70. {
  71. if(i==d)
  72. {
  73. str6 = str4+str5;
  74. c+=7, d+=11;
  75. }
  76. else
  77. {
  78. str6 = str4;
  79. c+=7;
  80. }
  81. }
  82. else if(i==d)
  83. {
  84. str6 = str5;
  85. d+=11;
  86. }
  87. if(str6.size()==0)
  88. {
  89. cout << i << " " << i << endl;
  90. }
  91. else
  92. {
  93. cout << i << " " << str6 << endl;
  94. }
  95. str6 = str1;
  96. }
  97. return 0;
  98. }
Success #stdin #stdout 0s 3476KB
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 Buzz
36 Fizz
37 37
38 38
39 Fizz
40 Buzz
41 41
42 Fizz
43 43
44 Eleven
45 FizzBuzz
46 46
47 47
48 Fizz
49 49
50 Buzz
51 Fizz
52 52
53 53
54 Fizz
55 BuzzEleven
56 56
57 Fizz
58 58
59 59
60 FizzBuzz
61 61
62 62
63 Fizz
64 64
65 Buzz
66 FizzEleven
67 67
68 68
69 Fizz
70 Buzz
71 71
72 Fizz
73 73
74 74
75 FizzBuzz
76 76
77 Eleven
78 Fizz
79 79
80 Buzz
81 Fizz
82 82
83 83
84 Fizz
85 Buzz
86 86
87 Fizz
88 Eleven
89 89
90 FizzBuzz
91 91
92 92
93 Fizz
94 94
95 Buzz
96 Fizz
97 97
98 98
99 FizzEleven
100 Buzz