I have this program and I am trying to output the value of n, but I am not getting any display. Program complies but no output.
#include <stdio.h>
int rec(int x, int y)
{
static int count = 0;
if(x==0)
return count;
count++;
if(x > y)
rec(x - y, y);
else
rec(x,y-x);
return count;
}
main(){
int i=0, j=2, n;
n = rec(i,j);
printf("%d", n);
}
Need the value of N as output, program doesn't display anything.
0. Are you sure that's the code you're actually running?