Computer memory is a bunch of layers, starting with smallest-fastest memory and going to largest-slowest memory. The layers are transparent to programmers (except at machine language level). The operating system and hardware move data up and down the hierarchy or layers as data is needed. The hierarchy looks something like this on most machines:
* registers
* cache (L1)
* cache (L2)
* RAM
* swap file on a disk
In order for data to be transformed or manipulated, it must move all the way up the hierarchy, through each layer, until it resides in a register. There it can be changed, then it moves back down to the hierarchy. Much of the time, a data item or number is just sitting in "memory" not being used, and at those times, it can be anywhere along the hierarchy, including out on the disk.
This is highly simplified, but as a programmer (except when programming against the metal) you usually don't care too much about where the operating system stores a number. The time when you DO care is if you have to "tune" an application to run faster. And that is a very complex matter. You'd need to read an entire book on memory hierarchy (in a computer architecture book) to even begin to start understanding all the tricks employed in the OS and hardware to make this work well.
Howeverk, programmers generally DO care about how "big" the data item is, that is, 32 bits for an Int32. The data width determines the largest (or smallest) integer that can be used.
In real life, we do a similar thing with books. A book can only be read when it is out on the table and open ("in a register"). We keep some books on the bookshelf (i.e., in "RAM"), and go get them when we need to read them. We keep other, less-often-needed books, maybe in a box in the basement (i.e., "in the swap file on disk").