Helpe me with programing my function

You cannot do that.

You could either have your values in arrays, and reference the array slices by number, or use a preprocessor macro.

#define set(P)  \
  x ## P = 31; \
  y ## P = 50; \
  z ## P = 80;