blef.
A = im2double(imread('cameraman.tif'));
s = imsize(A,3); % nonstandard; see attached file
B = zeros([s 4]);
for f = 1:4
B(:,:,:,f) = circshift(A,round(s(1:2)*f/4));
end
subplot(1,2,1)
montage(B)
% summing the images will push values out of standard data ranges for no good reason
% use the mean to keep data sane and usable/writeable.
C = mean(B,4);
subplot(1,2,2)
imshow(C)
Note that the assignment describes the image as a periodic function and asks you to circshift by size/4 to demonstrate a full cycle of the image. This doesn't work unless the image geometry is integer-divisible by 4. Also, as the note mentions, there's no good reason to add the images instead of using the mean. The sum of the images will be outside of standard data range and will need to be renormalized for many tasks (e.g. writing the image to a file). Normalizing the sum of floating point images is the same as taking the mean. Just take the mean.
I don't know what anyone is supposed to learn from this other than to question everything.