我后来想了想,是这样写的,最后好像也可以运行
#include <stdio.h>
int main()
{
printf("please input a num:");
int n = 0;
int sum = 0;
scanf_s("%d", &n);
if (n <= 1)
printf("the num is wrong\n");
else
for (int i = 1; i <= n; i++)
{
if (i % 2 == 0)
{
int z = i * i;
printf("%d\n", z);
}
}
return 0;
}