Help me in solving LBCP08A problem

My issue

My code

#include<stdio.h>
int main(){
    int M,N;
    

Learning course: C for problem solving - 2
Problem Link: CodeChef: Practical coding for everyone