I'm new to photography. I got Nikon D3100 with 18-55 KIT.
I was looking to buy 1.8f prime lens.
I found two options.
AF-S DX NIKKOR 35mm f/1.8G and AF-S DX NIKKOR 55mm f/1.8G
Which one you guys prefer ?
The question here doesn't — or shouldn't — come down to what we prefer, but rather what you want to use it for. These lenses (because of their different focal length) have a significantly different angle of view, which means that they serve different purposes. Eventually, you may find that you want both.
On your APS-C Nikon, the 50mm lens acts as a short portrait lens. It's kind of awkward for most anything else, but is just about perfect for taking head-and-shoulders portraits. I say awkward because it's not enough "reach" to pick out details like a longer telephoto lens, but is narrow enough that it's difficult to frame indoor scenes. That doesn't mean you can't use it more generally, of course.
The wider 35mm acts as a normal lens — it gives a comfortable and versatile field of view that doesn't feel either wide-angle or telephoto. For that reason, if you're just going to pick one of the two, this is probably going to be your best bet. But it depends on what you're looking for — a portrait lens may be just what you need.
Basically, this will depend on your needs as a photographer. I guess you should first figure that out. Anyway, both lenses are perfect for portrait and landscape photography. Both have motors (so they are perfect for your D3100). Because of the f1.8 aperture, both are good in low-light conditions. If I have a D3100 camera or any DX format camera, I would just flip a coin to decide--both lenses are okay on a DX format camera. But, if I have a Nikon FX format or full frame camera, I will definitely get the NIKKOR 50mm f/1.8G lens. Well, actually, if I have a FX format camera I'll just get the NIKKOR 50mm f/1.8D lens. It is cheaper and is as powerful as the other 50mm lenses. The 35mm lens is not very compatible with a FX format camera.
I prefer the 35mm. I actually have the d3100 and upgraded to the nikkor 35mm f/1.8 a few months ago.
I will get the 50mm however, but use it only for portraiture (not the best, but still cheap, fast and compact).
As an exercise try to shoot all day at 35mm with your kit lens. And then 50mm. You will know for sure what you need.