Тема: Спрощення умови
int function_recursion(int length, int i)
{
if (length == 0) return amount;
if (str[i] == '0' || str[i] == '1' || str[i] == '2' || str[i] == '3' || str[i] == '4'
|| str[i] == '5' || str[i] == '6' || str[i] == '7' || str[i] == '8' || str[i] == '9') amount++;
i++;
length--;
return function_recursion(length, i);
}
Чи можна спростити дану умову:
if (str[i] == '0' || str[i] == '1' || str[i] == '2' || str[i] == '3' || str[i] == '4'
|| str[i] == '5' || str[i] == '6' || str[i] == '7' || str[i] == '8' || str[i] == '9') amount++;
?