The answer is that the calculation you are performing is not the calculation you think you are performing. Here's a question for you - what do you get when you divide 275 by 300? The answer is not 0.91666 as you are expecting - it's actually 0, so 0 * 100 = 0.
I know this seems wrong, but I've divided two integers here, and the result is 0. What you are trying to do is divide 275 as a floating point number. Fortunately there's a quick fix. Change this calculation to be
percentage = (double)obtainedMarks / totalMarks * 100;
Now when you run it, you get the answer you are expecting.