Something wrong with this code. Sum result is wrong please help me guys

#include<stdio.h>
#include<conio.h>
void lol(long z)
{
long r,k,sum=0;
for(k=0;k<=10;k++)
{
sum=0;