TOPIC
Como fiz - C++
DeyvsonLuiz asked 1 year ago
include
using namespace std;
int main() {
int notas[]={100, 50, 20, 10, 5, 2};
int preco, pagamento, resposta=0;
cin >> preco >> pagamento;
while(preco!=0 && pagamento!=0){
int troco=pagamento-preco;
for(int i=0; i<6; i++){
if(notas[i]<=troco){
troco-=notas[i];
resposta++;
}
}
if(resposta==2){ cout << "possible" << endl; }
else{ cout << "impossible" << endl; }
resposta=0;
cin >> preco >> pagamento;
}
return 0;
}