Given IP is 18.104.22.168 and subnet mask is 255.255.255.240. It's a class C network.
last octet of given IP is 1100 0111 and the first four most significant bits(from left to right) will be subnet bits, rest host bits.
As per new RFC of subnet, 0th subnet and subnet in which all subnet bits are 1 are treated as valid subnet.
First subnet Id would have all zeroes in subnet bits and all 0 in host bits.-22.214.171.124
Second subnet ID would be 126.96.36.199 (subnet bits 0001)
last subnet ID : 188.8.131.52 (subnet bits 1111)
Ip address of last host of last subnet : 184.108.40.206 (Subnet bits 1111 host bits 1110)