code for ex46 done