(try implementing a macro on the level of loop in te C preprocessor)
#define sum(i,acc) acc+=i;
#define loop(x,y,func) ({int acc=0;for(int i=x;i<y;i++){func(i,acc);}acc;})
#define sumloop(x,y) loop(x,y,sum)
the above is (loop for i from 1 to 10 sum)