A logical relation among several unknown variables is known as a constraint, where each variable in a given domain takes a value. The basic idea behind constraint programming framework is to model the problem as a set of variables with domains and a set of constraints.This problem has been studied since 1897 i.e. more than a century. In this paper we will consider a problem which will represent the basic features of constraint programming. We will here use constraint programming to solve this problem of knapsack. Our goal is to select items which have a greatest total value under certain conditions of limit on weight.