-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path17293.cpp
More file actions
31 lines (29 loc) · 976 Bytes
/
17293.cpp
File metadata and controls
31 lines (29 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// 17293. 맥주 99병
// 2021.02.28
// 입문용, 구현
#include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int first = n;
while (n >= 1)
{
if (n == 1)
{
cout << n << " bottle of beer on the wall, " << n << " bottle of beer." << endl;
cout << "Take one down and pass it around, no more bottles of beer on the wall." << endl;
}
else
{
cout << n << " bottles of beer on the wall, " << n << " bottles of beer." << endl;
cout << "Take one down and pass it around, " << (n - 1) << ((n - 1 == 1) ? " bottle" : " bottles") << " of beer on the wall." << endl;
}
cout << endl;
n--;
}
cout << "No more bottles of beer on the wall, no more bottles of beer." << endl;
cout << "Go to the store and buy some more, " << first << ((first - 0 == 1) ? " bottle" : " bottles") << " of beer on the wall." << endl;
return 0;
}