#include <iostream>
using std:: cout;
using std:: cin;
using std:: endl;
int main() {
int nominals[] = {5000, 2000, 1000, 500, 200, 100};
int requested;
cin >> requested;
cout << "Запрашиваемая сумма: " << requested << endl;
if (requested % 100 != 0) {
cout << " - Невозможно предоставить " << requested << ". Не должно быть меньше 100." << endl;
} else if (requested > 150000) {
cout << " - Невозможно предоставить " << requested << ". Не должно превышать 150000" << endl;
} else {
for (auto nominal : nominals) {
cout << " - " << nominal << " x " << (requested / nominal) << endl;
requested %= nominal;
}
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter