can i put a 512 ram and a 256 ram in two slots . and both wo

It depends on the actual PC model, but generally speaking, yes. Some computers have "dual channel" RAM slots which means you will get better performance by fitting a matching pair of RAM modules, each having the same capacity.
It's impossible to be more specific without knowing your PC make & model, something you should have included in your post with a question like that.
