Strange results from the C program

Hello, I am getting up to speed with C during the week and I have written one of my first programs and I do not understand why the return of the function. If I input X as 3, Y as 4 and N as 6 I get the return as several million. I should be getting the return of check funtion as 1 with those inputs.

you are getting such results in printf statement because you have written your statement as

[b]printf("check = %d", check);[/b]

What this will do is print the address where your function is present in the memory. But if your statement as

[b]printf("check = %d", check());[/b]

which I thing you intended for.

One more thing you should rewrite your check method/function, as if conditions are not satisfied you will end up in returning a garbage value to your return statement. For beginners it is prefered to code in the way our other fellow programmers have modified your code.