Not sure what you are saying, but the G major scale has one sharp, F#, if you replace that, then it is a C major. If I understand you right.
Same with the second. D minor has one flat, remove the Bb, and make it a B, you are now in C major.
Easiest way to move through the keys is to find a circle of fifths, you will see its major on top and its minor on the bottom. When you change one the notes, it usually moves one way left or right.
If I got this wrong, I am sure I will be corrected real quick. But that is as simple as I can make it.