My code for fundamental question