I created such a simple method for issuing change to a wendigo device, the problem is with else if blocks, else cannot run the operator
int changeTen = vendigoBalance / 10;
int change = vendigoBalance % 10;
else if (change == 0)
{
Console.WriteLine($"Ваша здача в 10 - {changeTen}");
return;
}
int changeFive = change / 5;
change = change % 5;
else if(change == 0){
Console.WriteLine($"Ваша здача в 10 - {changeTen}, в 5 - {changeFive}");
}
int changeToo = change / 2;
change = change % 2;
else if (change == 0)
{
Console.WriteLine($"Ваша здача в 10 - {changeTen}, в 5 - {changeFive}, в 2 - {changeToo}");
}
int changeOne = change / 1;
change = change % 1;
else if (change == 0)
{
Console.WriteLine($"Ваша здача в 10 - {changeTen}, в 5 - {changeFive}, в 2 - {changeToo}, в 1 - {changeOne}");
}
It turns out to be implemented through if, but this is obviously not correct and the cycle stupidly ends, but I would like to continue it))
CS8641 “still” cannot start the operator
New contributor
Виталий is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.