if (n%2==0) y=y-s/t;
else y=y+s/t;
s*=x*x;
t*=(j+1)*(j+2);
j+=2;
n++;
} while(fabs(y0-y)>eps);
printf("%f\n",sin(x));
system("PAUSE");
return 0;
}
2.3 判断输入的字符的类型
我们将字符分为五类:大写字母、小写字母、数字、控制字符、其他字符。
编写程序,从键盘输入一个字符,输出字符所属的类型:大写字母时输出capital letters, 小写字母时输出small letters,数字是输出figures,其他字符时输出 others。 #include<stdio.h>
void main()
{
char c;
c = getchar ( );
if (c < 0x20)
printf ("The character is a control character\n");
else if (c >= '0' && c <= '9')
printf ("figures\n");
else if (c >= 'A' && c <= 'Z')
printf ("capital letters\n");
else if (c >= 'a' && c <= 'z')
printf ("small letters\n");

