function print(file, problem)
    switch(problem)
        case 1
            A = imread(file);
            R = A(:, :, 1);
            rgb = A;
            rgb(:, :, 2:3) = 0;
            figure;
            subplot(1, 2, 1);
            imshow(rgb);
            title('machupicchu02.jpg');
            subplot(1, 2, 2);
            histogram(R);
            title('histogram');
            fprintf("R's mean: %.2f, median: %d, mode: %d\n", mean(R(:)), median(R(:)), mode(R(:)));
            G = A(:, :, 2);
            rgb = A;
            rgb(:, :, [1 3]) = 0;
            figure;
            subplot(1, 2, 1);
            imshow(rgb);
            title('machupicchu02.jpg');
            subplot(1, 2, 2);
            histogram(G);
            title('histogram');
            fprintf("G's mean: %.2f, median: %d, mode: %d\n", mean(G(:)), median(G(:)), mode(G(:)));
            B = A(:, :, 3);
            rgb = A;
            rgb(:, :, 1:2) = 0;
            figure;
            subplot(1, 2, 1);
            imshow(rgb);
            title('machupicchu02.jpg');
            subplot(1, 2, 2);
            histogram(B);
            title('histogram');
            fprintf("B's mean: %.2f, median: %d, mode: %d\n", mean(B(:)), median(B(:)), mode(B(:)));
        case 2
            fin=fopen(file,'r');
            X=fread(fin, 128*128,'uint8=>uint8'); fclose(fin);
            Y=reshape(X, 128, 128);
            Y=Y';
            figure;
            subplot(2,2,1);
            imshow(Y);
            subplot(2,2,2);
            histogram(Y);
            subplot(2,2,3);
            imshow(histeq(Y,4));
            subplot(2,2,4);
            histogram(histeq(Y,4));
            disp(unique(histeq(Y,4)));
        case 3
            fin=fopen(file,'r');
            arg = fscanf(fin, "%d %d %d %d %d", [5, 1]);
            pix = ones(arg(4), arg(5))*255;
            x0 = arg(1);
            y0 = arg(2);
            L = arg(3);
            k = fscanf(fin,"%1d");
            for j=1:L
                switch (k(j))
                    case 0
                        y0 = y0 + 1;
                    case 1
                        x0 = x0 - 1; y0 = y0 + 1;
                    case 2 
                        x0 = x0 - 1; 
                    case 3
                        x0 = x0 - 1; y0 = y0 - 1;
                    case 4
                        y0 = y0 -1;  
                    case 5
                        x0 = x0 + 1; y0 = y0 - 1; 
                    case 6
                        x0 = x0 + 1; 
                    case 7
                        x0 = x0 + 1; y0 = y0 + 1;
                end
                pix(x0, y0) = 0;
            end
            figure;
            imshow(pix)
            title('S2.txt');
            fclose(fin);
        case 4
            QT = [16  11  10  16  24  40  51  61;
                  12  12  14  19  26  58  60  55;
                  14  13  16  24  40  57  69  56;
                  14  17  22  29  51  87  80  62;
                  18  22  37  56  68 109 103  77;
                  24  35  55  64  81 104 113  92;
                  49  64  78  87 103 121 120 101;
                  72  92  95  98 112 100 103  99];
            fin = fopen(file,'r');
            tmp = fscanf(fin, "%d", [8, inf]);
            tmp = tmp';
            tmp = dct2(tmp-128);
            tmp = round(tmp ./ QT);
            vec = zigzag(tmp);
            xx = 1;
            while(xx<=64)
                if(xx==1)
                    s = vec(xx);
                    num = strlength(dec2bin(abs(s), 1));
                        fprintf("(%d, %d)", num, s);
                else
                    cnt = 0;
                    while(xx<=64 && vec(xx)==0)
                        cnt = cnt+1;
                        xx = xx+1;
                    end
                    if(xx==65)
                        fprintf(", EOB");
                    else
                        t = vec(xx);
                        num = strlength(dec2bin(abs(t), 1)); 
                        fprintf(", (%d, %d, %d)", cnt, num, vec(xx));
                    end
                end
                xx = xx+1;
            end
            fprintf("\n");
            ref = idct(tmp);
            [peaksnr, ~] = psnr(tmp, ref);
            fprintf('\n The PSNR value is %0.4f\n', peaksnr);
    end
