初学者的小问题
#include <stdio.h>int square(int m){
int n;
for (n = 1 ; (2*n)*(2*n) <= m ; n++)
printf( " %d\n",(2*n)*(2*n));
}
int main()
{
int m;
printf( "enter a digit to show the square: ");
scanf( " %d " ,&m);
printf( “%d\n”,square(m)) ;
return 0;
}
和
#include <stdio.h>
int main()
{
int m;
int n;
printf( "enter a digit to show the square: ");
scanf( " %d " ,&m);
for (n = 2 ; n*n<=; n+= 2)
printf( " %d\n" ,n * n);
return 0;
}
为什么第一个程序会多显示一次偶次平方