Problem A: 显示偶数平方值
Time Limit: 1 Sec Memory Limit: 128 MB
Total Submissions: 6575 Accepted: 3403 Creator: Imported
Problem Description
编写程序,显示出1 - n的所有偶数平方值。
Input Description
输入一个正整数n(10<n<1000)。
Output Description
按照从小到大的顺序输出结果,每行一个平方数。
Sample Input
100
Sample Output
4 16 36 64 100
#include <stdio.h>
int main(void)
{
int x, y;
scanf("%d", &x);
for(y = 2; y * y <= x; y = y + 2)
{
if(y * y <= x)
printf("%d\n", y * y);
}
}