Well, an example shows you how to do it. but lets give it a whirl without an example then.
As you know there are 4 classes but just 3 that are used: A, B and C
A is from 1.0.0.0 to 127.0.0.0
B is from 128.0.0.0 to 191.0.0.0
C is from 192.0.0.0 to 223.0.0.0
For class A the first octet is the network portion and the other three octets are for the hosts.
For class B the first 2 octets is the network portion and the remaining two are for hosts.
For class C the first 3 octets is for the network portion and the last one is the host portion.
The reason why we subnet is not to waste ip addresses.
For example: say we have this address 192.16.1.0 with a subnet mask of 255.255.255.0 with this address we can have 256 hosts in that network. but we only need 24 hosts actually. it would be a waste to assign that address there and then there would be 236 addresses left that are going to waste. so we subnet.
here is a chart that we can use to figure out what subnet to do this into:
http://area51services.com/information/subnet_mask/IP-class-classless-subnet-chart.jpg
now we have 24 hosts and we are in class C so we take a look at the chart and match up the subnet with the number of hosts. the 255.255.255.224 mask matches our requirements since it can accommodate 32 hosts.
so there we go: we then just write there 192.16.1.0/27 to say that we have subnetted this to the mask of 255.255.255.224.