what s the answer 3

Please write clearly logic solution for all the 4 problems. and the hand writing should be good. the final 2 question need to be typed based on C or C++ programs.