IIT Question: Find the Colour of the 9 Hats

The mystery of Hat Colour Nine IITians were sitting in a classroom. Their prof wanted to test them. One day he told all of his 9 students that he has 9 hats, colored either in red or black. He also added that he has at least one hat with red color and the no. of