I was talking to a friend today and he told me that a router changes the IP address you're given to by the ISP?
So I checked with whatismyip.org and let's say with the router, it showed, 18.104.22.1680
Then I took the router out and just used the modem and it showed as 22.214.171.1249
If I were to use a different router, would it end with 450 again? Or an entirely different number, because the router is of a different brand?
I'm assuming having a router is good for protection from malware, trojans and what not?
It depends on how your ISP handles IP addresses. Some use DHCP so every time you disconnect then reconnect you get a new address that happens to be free. Some have smarter DHCP servers like my ISP that remembers your device's mac address (unique identifier assigned to network interfaces) So I would get a different ip address on each device it plugged directly in to my modem, but if I plugged a device back in again it would get the same IP it had before.
But I would recommend using a router, it blocks allot more stuff trying to break in to your network, as well as adds the ability let multiple device connect to the internet at once