i is a static variable, so it will be placed in static memory section and it will not get re-initialized every time.
At first i = 6, then i will keep on decrementing till i is not 0. According to the code printf() will be called whenever the if statement is correct, so printf will be called for 5 times. when i = 1, we check --i , then i = 0. so when i = 0 printf() will not be called.
for 5 times 1 will be printed and for 0 times 0 will be printed.
X = 0,Y=5
so 2x+y =5