I am trying to calculate percentage, and my results are not correct. Suppose a Student Scores 18.70 out of 30 in Subject1 & 29.75 out of 40 in Subject2.
I have calculated percentage of Subject1 as 62.33% & for Subject2 74.38%.
While calculating the final percentage If I average both percentages I get 68.35% but If I calculating the percentage by adding scores of both Subjects i.e. 48.45 out of 70 the percentage is 69.21%.
I know know 69.21% is correct but I fail to understand why average is coming wrong, and is there any way with which I can get final percentage from percentages in each subject.
I know I am very bad in math,
be gentle.

It is not clear from the original post just what is being asked,
There are two subjects.  The assessment tool to evaluate each one has a different maximum number of possible marks.  This decision does not have anything to do with the relative importance of the two subjects. 
You have correctly converted these marks to percentages, so the results in the two subjects can be compared.
If you were told that the two subjects were equally important in finding the overall mark, you would average the two percentages.
If you were told that the subjects' importance was in direct proportion to the total marks available in each one, then you would proceed as in the accepted answer.  But what if the instructor in Subject #1 decides to report the mark as $187$ out of $300$?  Does that change the students overall program grade? Should it?
